|
Craig,
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.
Regards,
Thomas.
Am 01.11.2019 um 17:48 schrieb Craig Richards:
A slightly more efficient version might be
dcl-f(?>\s+)filea
or in your case
dcl-f(?> +)filea
or
dcl-f(?>[ ]+)filea
(I'm very surprised the \s suggested by David did not work - that's pretty
standard stuff).
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 will
backtrack, 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 it
gets past the closing parenthesis, it throws away all states so it doesn't
go 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 the
next bit has failed - there is no point in dropping the last character of
the greedy match and retrying the expression again.
regards,
Craig
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.