|
On Fri, Jan 20, 2012 at 4:41 PM, John McKay<jmckay@xxxxxxxxxxxxxxxx> wrote:
I would useInteresting phone number. That's not a U.S. or Canadian phone number,
\d(2,3)\W\d(2,3)\W\d(2,3)
\d(2,3) looks for either 2 or 3 digits.
\W looks for a single non-alphanumeric character, i.e.
your separator.
though. ;)
When parsing data, there is always the issue of how permissive you
want to be. If the whole point is to only pick out *exactly
formatted* data, then "single non-alphanumeric" is not necessarily as
good as the specific separator you are looking for. If the point is
to be a little flexible, then you may want to allow separators that
are anywhere from zero to two characters (like a right-paren and a
space, for example, if you're looking for phone numbers including an
area code).
This is from the RPG manual and is also on rpglanguage.comTo echo Scott's advice: Use the documentation for your specific regex
implementation, if possible. There are a number of similar but
not-quite-compatible regex "languages". I'm used to {m,n} for
denoting minimum of m, maximum of n occurrences (that is, curly braces
instead of parens).
John Y.
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.