|Date: ||Wed, 18 Feb 2009 22:23:24 -0800|
|Reply-To: ||Savian <savian.net@GMAIL.COM>|
|Sender: ||"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>|
|From: ||Savian <savian.net@GMAIL.COM>|
|Subject: ||Re: RX PARSE question (SAS 9.2)|
|Content-Type: ||text/plain; charset=ISO-8859-1|
I am unsure as to why you want to learn the older SAS regular
expressions when they have bene replaced with an industry standard.
Skip the old stuff and learn the Perl regex functions. There are loads
of resources on the web to help you if you choose to go in that
Buy RegexBuddy and never look back. It will save you a TREMENDOUS
amount of time.
On Feb 18, 3:52 pm, Ezra Barzilay <ezra.barzi...@gmail.com> wrote:
> New to REGEX and ignorant of PERL syntax (and thus PRX Functions), I
> am (slowly) learning how to use the RX Functions that SAS provides.
> I am a bit stuck with the following: I am trying to identify a pattern
> that starts with an optional "AAC" or "G", an optional dash, followed
> by a 0 or 9, a number between 0 and 9 another dash and 4 (but no more)
> alphanumeric characters.
> I am using the following pattern into an rxmatch expression to label
> the record as matchpos 0 or 1.
> ([AAC|G]) ['-'] (9|0) ($'0-9')
> '-' $d$d$d$d"
> The problems I am running into:
> (i) $d$d$d$d will pick up any alphanumeric string that has at least 4
> characters. How can I restrict the pattern to *only* match the pattern
> if that substring is exactly 4 alpha-numeric characters?
> (ii) in the situation of a modification function where I am using the
> rxparse to change from Pattern1 to Pattern2, is there a way to add
> position markers (i.e. @int) that are relative to the presence of
> optional preceeding strings? In the above pattern, (9|0) is @0 if none
> of 'AAC' or 'G' or '-' are present but anywhere between @2 and @5 if
> they are.
> Finally: is there any good reference text (I have read most of the
> native SAS documentation on this and a few SUGIs) on how to build the
> SAS non-PERL regex?
> Many thanks