[prev in list] [next in list] [prev in thread] [next in thread]
List: sas-l
Subject: Re: SAS regex, suffix option
From: toby dunn <tobydunn () HOTMAIL ! COM>
Date: 2004-12-31 17:28:30
[Download RAW message or body]
Ahh.... One more reason why reg expressions are for writing and not
reading...
By the way for all those interested my new email addy is
tobydunn@hotmail.com atleast till I getset up at my new shop.
Happy new years to you all...
Toby Dunn
From: "Chang Y. Chung" <chang_y_chung@HOTMAIL.COM>
Reply-To: "Chang Y. Chung" <chang_y_chung@HOTMAIL.COM>
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: SAS regex, suffix option
Date: Fri, 31 Dec 2004 11:27:42 -0500
Received: from mc3-f12.hotmail.com ([64.4.50.148]) by mc3-s8.hotmail.com
with Microsoft SMTPSVC(5.0.2195.6824); Fri, 31 Dec 2004 08:27:44 -0800
Received: from malibu.cc.uga.edu ([128.192.1.103]) by mc3-f12.hotmail.com
with Microsoft SMTPSVC(5.0.2195.6824); Fri, 31 Dec 2004 08:27:44 -0800
Received: from listserv.cc.uga.edu (128.192.1.75) by malibu.cc.uga.edu
(LSMTP for Windows NT v1.1b) with SMTP id <1.00DD3CD0@malibu.cc.uga.edu>;
Fri, 31 Dec 2004 11:27:42 -0500
Received: from LISTSERV.UGA.EDU by LISTSERV.UGA.EDU (LISTSERV-TCP/IP release
1.8d) with spool id 27054 for SAS-L@LISTSERV.UGA.EDU; Fri, 31 Dec
2004 11:27:42 -0500
Received: from malibu.cc.uga.edu (malibu.cc.uga.edu [128.192.1.103]) by
listserv.cc.uga.edu (8.12.11/8.12.11) with ESMTP id iBVGRgCY011082
for <SAS-L@LISTSERV.UGA.EDU>; Fri, 31 Dec 2004 11:27:42 -0500
Received: from listserv.cc.uga.edu (128.192.1.75) by malibu.cc.uga.edu
(LSMTP for Windows NT v1.1b) with SMTP id
<2.00DD3C83@malibu.cc.uga.edu>; Fri, 31 Dec 2004 11:27:42 -0500
X-Message-Info: TiNwL5K19MFwMJ40yXn5XvgfxDoBmVJMpY5QkqAtPtU=
Newsgroups: bit.listserv.sas-l
Comments: To: "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Return-Path: owner-sas-l@LISTSERV.UGA.EDU
X-OriginalArrivalTime: 31 Dec 2004 16:27:44.0725 (UTC)
FILETIME=[A8402050:01C4EF55]
On Fri, 31 Dec 2004 09:32:59 -0500, Richard A. DeVenezia
<radevenz@IX.NETCOM.COM> wrote:
>I'm trying to use SAS regex to check for a pattern at the end of a string.
>
>Any ideas why the first oodles is matched instead of the last ?
>
>-----
>data _null_;
> text = "oodles of snicker doodles";
>
> rx = rxParse ( " oodles $s " );
>
> call rxSubstr ( rx, text, pos, len );
> put pos= len=;
>
> call rxFree ( rx );
>run;
>-----
>pos=1 len=6
>
>Was expecting
>pos=20 len=6
Hi, Richard,
If you want to check the end of the string, then you can use @0 -- the
beginning of the line is @1.
rx = rxParse ( " oodles @0 " );
results in
pos=20 len=6
You can also do something like below to match a word that ends
with 'oodles' (and a following white space or the end of line char) but
starts with something other than a space character:
rx = rxParse ( " ~' '+ oodles $s|@0 " );
which results in
pos=19 len=7 (which is interesting -- I think :-))
I think in sas regEx, both $s and $S matches with a white space character,
while in sas perlRegEx, $ matches the end of line.
Cheers,
Chang
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic