× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Seriously, from the API doc:
If the regcomp() function is successful, it returns 0. Otherwise, it returns an error code that you can use in a call to the regerror() function, and the content of preg is undefined.

This is for 7.2 but you can change version
https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_72/rtref/regerror.htm#regerror


-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Francois Lavoie
Sent: Thursday, May 14, 2020 17:43
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: RE: regcomp returning 13 error

Code 13=error between the keyboard and the chair LOL j/k

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of iseriesstuff
Sent: Thursday, May 14, 2020 17:36
To: Midrange <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: regcomp returning 13 error

Im trying to use regcomp/regexec to extract emails from a long string.
When i test the code, the return code is 13. Where can i find out what that means?

code:

P eminnote B export
*-------------------------------------------------------------------
D eminnote PI 60 dim(20) D claimin 7 0 const D datain 1000 const

d data s 1000a inz varying d regex_ph_nbr ds inz likeds(regex_t) d dsrm ds inz likeds(regmatch_t) dim(100) d ast s 60 inz(*all'*') d pattern s 1000a inz varying d rc s 10i 0 inz(0) d rtnval s 60 dim(20) d rtnval_c s 3 0 d email s 60

clear rtnval;
data = datain;
open CLPHONEL11;

pattern =
'[a-z0-9]+([-+._][a-z0-9]+){0,2}@.*?(\.(a;'
+'(?:[cdefgilmnoqrstuwxz]|ero|(?:rp|si)a)|'
+'b(?:[abdefghijmnorstvwyz]iz)|c(?:'
+'[acdfghiklmnoruvxyz]|at|o(?:m|op))|'
+'d[ejkmoz]|e(?:[ceghrstu]|du)|f[ijkmor]|'
+'g(?:[abdefghilmnpqrstuwy]|ov)|h[kmnrtu]|'
+'i(?:[delmnoqrst]|n(?:fo|t))|j(?:[emop]|'
+'obs)|k[eghimnprwyz]|l[abcikrstuvy]|'
+'m(?:[acdeghklmnopqrstuvwxyz]|il|obi|'
+'useum)|n(?:[acefgilopruz]|ame|et)|o(?:m|'
+'rg)|p(?:[aefghklmnrstwy]|ro)|qa|r[eosuw]|'
+'s[abcdeghijklmnortuvyz]|t(?:[cdfghjklmnoprtvwz]|'
+'(?:rav)?el)|u[agkmsyz]|v[aceginu]|w[fs]|y[etu]|'
+'z[amw])\b){1,2}'
;

rc = regcomp(regex_ph_nbr :pattern :REG_EXTENDED) ; if rc = 0 ;
dow '1' ;
rc = regexec(regex_ph_nbr:
data:
regex_ph_nbr.re_nsub :
dsrm :

if rc <> 0 ;
leave ;
endif ;

email =
%subst(data:dsrm(1).rm_so+1:dsrm(1).rm_eo-dsrm(1).rm_so);

setll (email:claimin) clphonel11;
if not %equal;
rtnval_c += 1;
rtnval(rtnval_c) = email;
endif;

%subst(data:dsrm(1).rm_so+1:dsrm(1).rm_eo-dsrm(1).rm_so) = ast;
enddo ;
endif ;
regfree(regex_ph_nbr) ;

close CLPHONEL11;
return rtnval;

--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com Confidentiality Warning/Avertissement de confidentialité:

This message is intended only for the named recipients. This message may contain information that is privileged or confidential. If you are not the named recipient, its employee or its agent, please notify us immediately and permanently destroy this message and any copies you may have. Ce message est destiné uniquement aux destinataires dûment nommés. Il peut contenir de l'information privilégiée ou confidentielle. Si vous n'êtes pas le destinataire dûment nommé, son employé ou son mandataire, veuillez nous aviser sans tarder et supprimer ce message ainsi que toute copie qui peut en avoir été faite.
--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com
Confidentiality Warning/Avertissement de confidentialité:

This message is intended only for the named recipients. This message may contain information that is privileged or confidential. If you are not the named recipient, its employee or its agent, please notify us immediately and permanently destroy this message and any copies you may have. Ce message est destiné uniquement aux destinataires dûment nommés. Il peut contenir de l'information privilégiée ou confidentielle. Si vous n'êtes pas le destinataire dûment nommé, son employé ou son mandataire, veuillez nous aviser sans tarder et supprimer ce message ainsi que toute copie qui peut en avoir été faite.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.