|
Hi Dennis,
Thanks for your comments.
I had three objectives for producing this implementation.
The first objective was to use a single call instead of REGCOMP, REGEXEC
and REGFREE.. This is closer to the "standard" implementation found in
other
languages and scripts. It also makes regular expressions more accessible
to
those who are unfamiliar with the IBM api's.
My second objective was to remove the confusion / ambiguity caused by
differing character sets / ccsid's. While I cannot guarantee that my
implementation will work successfully across all the character sets /
ccsid's, it is more robust than the IBM-supplied api's.
My third objective was to widen the range of regular expressions
available here. Allied to this was the need to improve the documentation
for RPG developers.
Two of the examples illustrate a return position rather than 1 (alpha, h
and alp25a, \d, both of which return position 4).
Messages which can be of help in determining whether a regular
expression is valid or not can be obtained from the return code. A
negative
return code (range -1 to -18) will indicate the message based on the IBM
documentation. These return codes are in the readme, which can be viewed
on
line.
I agree with you in that "the hard part is in coming up with the right
expression". This is the case in all implementations of regular
expressions. Different implementations use different (albeit very similar)
syntaxes and there is a set of standard escape characters and punctuation
characters.
I had considered an implementation of REGEXEC on its own, but this
cannot be done without a related implementation of REGCOMP. If you think
this to be useful, I will look at it again.
Regards,
John McKay mba
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.