FYI: I cannot make regcomp() and regexec() working with character
classes such as "\s". I tried various things without success. Using
REGEXP_COUNT works like a charm but is incredible slow (200 times slower
Therefore I posted the problem at the rpg400-l mailing list hoping to
get help there: "Regular expression (regcomp()) ccsid issue".
Am 02.11.2019 um 11:26 schrieb Tools/400:
Interesting stuff. Thank you for letting us know.
Because of the "\s" issue, I assume that it is a ccsid problem. That is
what needs to be debugged. I hope that I can do that today or tomorrow.
Am 01.11.2019 um 17:48 schrieb Craig Richards:
A slightly more efficient version might be
or in your case
(I'm very surprised the \s suggested by David did not work - that's
Essentially this is wrapping the one-or-more whitespaces \s+ with (?>)
which is called Atomic Grouping.
The \s+ is greedy which is to say it will grab as many whitespace
characters as it can and then look at the next part of the expression to
carry on matching (in your case the filea) If that fails to match, it
itbacktrack, so if it grabbed 3 spaces, it will drop one and then try to
match and so on until it can't backtrack anymore.
The atomic grouping stops that backtracking process - essentially once
doesn'tgets past the closing parenthesis, it throws away all states so it
thego back and try with, say 2 spaces then one space.
Maybe not an issue for you and maybe not supported if not even \s is
supported but it's a good performance thing to be aware of for the
situations where it's obvious that once you've done a greedy match and
ofnext bit has failed - there is no point in dropping the last character
the greedy match and retrying the expression again.
This is the Rational Developer for IBM i / Websphere Development Studio
Client for System i & iSeries (WDSCI-L) mailing list
To post a message email: WDSCI-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
or email: WDSCI-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
Help support midrange.com by shopping at amazon.com with our affiliate
As an Amazon Associate we earn from qualifying purchases.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.