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



Scott,

http://en.wikipedia.org/wiki/Regular_expression is a good starting point to get into regular expressions.

Regards,
John McKay mba
www.rpglanguage.com

On 20/01/2012 19:46, Scott Klement wrote:
Hi Mike,

You have to understand that there are many tools out there that refer to
their expressions as "regular expressions". But there's no single
standard for them.

In this case, the expressions you're looking at are for a .NET tool
called "Expresso". (I'm not a .NET guy, and hadn't heard of this one
before.)

The regcomp/regexec routines in the C runtime support POSIX basic and
extended regular expressions, as described here:
http://en.wikipedia.org/wiki/Regular_Expressions

HTH


On 1/20/2012 1:12 PM, Smith, Mike wrote:
Well according to this
http://www.codeproject.com/KB/dotnet/regextutorial.aspx
it was supposed to look for a phone number.

But I'm going to try what you suggested.

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Friday, January 20, 2012 2:08 PM
To: RPG programming on the IBM i / System i
Subject: Re: experimenting with REGEX

hi Mike,

What is ' \b\d\d\d-\d\d\d\d' supposed to do? I've never seen an RE that
looks like that before.

I would've expected an RE to look more like this:
'[0-9]*[ -_]*[0-9]*'



On 1/20/2012 12:56 PM, Smith, Mike wrote:
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.?
NOTICE: This message, including any attachment, is intended as a confidential and privileged communication. If you have received this message in error, or are not the named recipient(s), please immediately notify the sender and delete this message.
--
This is the RPG programming on the IBM i / System i (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.

NOTICE: This message, including any attachment, is intended as a confidential and privileged communication. If you have received this message in error, or are not the named recipient(s), please immediately notify the sender and delete this message.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.