That is just riduculous to say you should stay away from REGEX on the iSeries. I use it at least a few times a week in my programs, and I have no problems with it. You just need to understand what you are doing.
One thing about REGEX is that most systems/Languages have there own implementation, some good some bad. At least IBM tried to follow the POSIX standard when they implemented REGEX. Granted there are some better flavors out there, at least they did not make up a new one.
*-------------
Aaron,
If I were to convert you REGEX to run on the iSeries, I came up with:
([[:graph:]][[:graph:]]{40,}|.{1,40})([[:space:]]+|$)
Be sure to compile it as Extended.
Chris Beck
Paul.Nicolay@xxxxxxxxxx 9/21/2008 1:09:02 PM >>>
Scott,
I also found this out some time ago (see other postings regarding
regex), and it should encourage everyone to stay away from it on
iSeries. Regex is only a valuable function if it would be available in
its most complete form (also see what other systems offer regarding the
"greedy" concept).
Hence for trivial things as splitting a line, one can better write its
own procedure.
Kind regards,
Paul
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: vrijdag 19 september 2008 16:01
To: RPG programming on the AS400 / iSeries
Subject: Re: regexec - chopping a large text string into chunks
Perhaps IBM's biggest crime in this situation is it's HORRIBLE
documentation. The docs say NOTHING about what is and is not supported
in their regcomp() API. The only thing I can find in the docs is this:
"The functions regcomp(), regerror(), regexec(), and regfree() use
regular expressions in a similar way to the UNIX(r) awk, ed, grep, and
egrep commands."
As an Amazon Associate we earn from qualifying purchases.