× 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.



I believe the reason Mike is getting an error is because the regex engine used by the iSys utilities
is the POSIX BRE and POSIX ERE engines which don't allow the word boundary designation "\b".

This regex should work as a POSIX ERE and find North American phone numbers:
\(?[0-9]{3}\)?[-. ]?[0-9]{3}[-. ]?[0-9]{4}

It can be modified for other number patterns desired.



On 1/20/2012 4:01 PM, RNewton wrote:
This is a great resource for testing out regex patterns with real time
feedback. I use it every time I mess with regex because I just can't
remember all the rules for the life of me.

http://gskinner.com/RegExr/

Robert Newton

From: "Smith, Mike"<Mike_Smith@xxxxxxxxxxxxxxxx>

I am attempting to use a regex from rpg.
Ideally I want to create a regex to look for patterns of numbers, such as
9 consecutive numbers, or 999-99-9999, or 999 or 99999_9999 or 9999_99999
The separator can be anything.

To start testing I tried this (this was an example regex I found to look
for a phone number). I have plenty of phone numbers in the file.

scpattern = ' \b\d\d\d-\d\d\d\d' ;

rc = regcomp(reg:
%trimr(scPattern):
REG_BASIC+REG_ICASE+REG_NOSUB) ;

Read record

rc = regexec(reg:SCCOM:5:match:0)

if rc<> 0
callp regerror(rc: reg: %addr(buf): %size(buf))
scMsg = %str(%addr(buf))
else
except det
endif

then loop and read next record

All I ever get for RC is 1 on my regexec RC is 0 when on regcomp.

Any idea what I'm doing wrong?
Any idea how to make a regex for my scenario.?

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.