I agree...
I have one for email. The tricky part with RPG is replacing the single quotes
myEmailRegex = <your regex>
myEmail is the string being evaluated.
Exec Sql
Set :myCount = regexp_count(lower(:myEmail), :myEmailRegex);
If myCount = 1;
return *on;
else;
return *off;
endif;
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of David Gibbs via RPG400-L
Sent: Tuesday, June 04, 2019 11:29 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Cc: David Gibbs <david@xxxxxxxxxxxx>
Subject: Re: Need help with a regex pattern
On Tue, Jun 4, 2019 at 10:23 AM <smith5646midrange@xxxxxxxxx> wrote:
Is there a way to build an expression so I can provide a variable
value at run time rather than freeing and recompiling the pattern
every time the variable changes?
Are you using the regex api's directly?
If so, I suggest you take a look at the SQL regexp_* functions.
https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_72/db2/rbafzscaregexp_substr.htm
They are much easier to work with IMO.
david
--
IBM i on Power Systems: For when you can't afford to be out of business!
I'm riding 615 miles (Yes, you read that right) in the American Diabetes Association's Tour de Cure to raise money for diabetes research, education, advocacy, and awareness. You can make a tax-deductible donation to my ride by visiting
https://mideml.diabetessucks.net.
You can see where my donations come from by visiting my interactive donation map ...
https://mideml.diabetessucks.net/map (it's a geeky thing).
I may have diabetes, but diabetes doesn't have me!
--
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@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
https://amazon.midrange.com
As an Amazon Associate we earn from qualifying purchases.