×
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.
On Fri, Jan 20, 2012 at 4:41 PM, John McKay <jmckay@xxxxxxxxxxxxxxxx> wrote:
I would use
\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.
Interesting phone number. That's not a U.S. or Canadian phone number,
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.com
To 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.