This had occurred to me but didn't fully understand the potential impact. I
should know that Scott never says anything that doesn't have value that
should be understood. I read that Wikipedia article, changed by regular
expression, and it selects the proper rows from my table now.
Thanks, John. Very much appreciated.
Regards,
Tom
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of John Yeung
Sent: Wednesday, March 28, 2012 8:27 PM
To: Midrange Systems Technical Discussion
Subject: Re: Anybody experienced with regular expressions and UDFs?
On Wed, Mar 28, 2012 at 6:54 PM, Monnier, Gary <Gary.Monnier@xxxxxxxxx>
wrote:
You can also look at
http://www.codeproject.com/Articles/9099/The-30-Minute-Regex-Tutorial
they have a phone number matching pattern of \b\d{3}-\d{4}.
Theirs \b\d{3}-\d{4}
Yours \d{3}-\d{4}
Maybe all you are missing is the \b?
This came up just a couple months ago on the RPG list. What people need to
understand is that there is no single, universal regex language. Just as
Oracle, MS SQL Server, DB2, mySQL, PostgreSQL, etc.
each have their own variants and extensions of the SQL language, each
implementation of regex is potentially a little different.
In particular, not all regex implementations support \d as a shortcut for
digit. According to Scott, the regex being used by the OP should handle
POSIX basic and extended (but *not* Perl-like!) regular expressions. See
http://archive.midrange.com/rpg400-l/201201/msg00171.html
http://en.wikipedia.org/wiki/Regular_Expressions
So you should stick to [0-9] instead. Also note that most modern
implementations of regex are Perl-like, and thus random docs, tutorials, and
testers you find on the Web are likely to be Perl-like as well. You really
have to use the docs that are specifically meant for your exact
implementation of regex.
John
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at
http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.