|
I like the look of it, but I have a couple of 'concerns'.
1. Could you implement it so that you don't need to explicitly pass the
terminating null character? Easy to check within your REGEXP procedure,
and
means that RPG programmers won't have to mess around themselves.
2. Following on from Dennis's concern(s), could you pass an (optional)
final
parameter to say wheter you want to perform REGFREE? Then, REGEXP can
check
whetherthe regexp has changed since the last time (and perform REGCOMP
if
necessary), and only do REGFREE if specified (or when the ActGrp ends,
of
course):
H bnddir('QC2LE')
D intotest s 256
D inpattern s 256
d regexp pr 10i 0 extproc('regexp')
d xtotest * value options(*string)
d xpattern * value options(*string)
d regfree 10i 0 options(*nopass)
d xreturn s 10i 0
d totest s like(intotest)
d totestptr s * inz(%addr(totest))
d pattern s like(inpattern)
d patternptr s * inz(%addr(pattern))
d cnull c x'00'
d REGFREE c 0
/free
intotest = 'myname@xxxxxxxxxxxxxxxx';
inpattern = '\w+@\w+\.\w{2,3}$';
totest = %trim(intotest);
pattern = %trim(inpattern);
xreturn = regexp (totestptr: patternptr: REGFREE);
dsply xreturn;
*inlr = *on;
/end-free
Just a thought (or two)
Rory
p.s. I still really like it. Don't think that these are all negatives -
just
observations...
As an Amazon Associate we earn from qualifying purchases.
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.