× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




Both Javascript 1.2 and Perl 5 support \w as:

JS \w, \W Match any word/non-word character
Perl \w matches alphanumeric, including _, \W matches non-alphanumeric

Interesting that the IBM documentation does not describe the RE grammar supported by these APIs.

I note that the MacOS X implementation states:

A backslashed character other than one specifically given a magic meaning
by IEEE Std 1003.2 (``POSIX.2'') (such magic meanings occur only in obso-
lete [``basic''] REs) is taken as an ordinary character.

thus I infer that if you want \w to have a magic meaning you need to compile without REG_EXTENDED. Given that the regex APIs are a POSIX.2 function I presume OS/400 exhibits similar behaviour however watch out for:

There are a number of decisions that IEEE Std 1003.2 (``POSIX. 2'') leaves
up to the implementor, either by explicitly saying ``undefined'' or by
virtue of them being forbidden by the RE grammar.

On 14/06/2008, at 4:45 PM, Scott Klement wrote:

I've never heard of \w, and I don't think that's part of the standard
regex syntax. Are you sure it's supported by the regcomp() API?

Why don't you just do something like:

^PRT[0-9A-Z]+

Not only is that a more standard syntax, but it seems easier to
understand what it means, IMHO.


Paul Jackson wrote:
Hello,

I am using a regex of ^PRT\w+ to select device names to be the letters
PRT followed by at least one digit or letter and am finding that the
execution of regexec only classes names valid if they are PRT followed
by a W. In Regex syntax the \w is supposed to match to a digit or
"word character" and the plus sign means "one or more".

Am wondering if anyone knows what is wrong? I compiled the regex with
REG_EXTENDED + REG_ICASE + REG_NOSUB if that helps.

Regards,
-Paul

--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



Regards,
Simon Coulter.
--------------------------------------------------------------------
FlyByNight Software OS/400, i5/OS Technical Specialists

http://www.flybynight.com.au/
Phone: +61 2 6657 8251 Mobile: +61 0411 091 400 /"\
Fax: +61 2 6657 8251 \ /
X
ASCII Ribbon campaign against HTML E-Mail / \
--------------------------------------------------------------------




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.