Date: Thu, 8 Nov 2007 22:06:39 -0500
Reply-To: Ken Borowiak <EvilPettingZoo97@AOL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ken Borowiak <EvilPettingZoo97@AOL.COM>
Subject: Re: Regex solution needed.
Upon further review, just a negative lookahead will not do. This one should
get the job done. I added more obs to check for robustness.
if _n_ = 1 then re = prxparse("/\b(\w+(?!')\b)(?<!s)/i");
infile cards truncover;
input string $20.;
if pos then match = prxposn(re, 1, string);
This regex looks for a 'word', but uses a negative lookahead to assert the
end boundary of the word is not an apostrophe('). Then it uses a negative
lookbehind to assert the last character is not an 's'.
On Thu, 8 Nov 2007 16:54:47 -0600, Yu Zhang <zhangyu05@GMAIL.COM> wrote:
>Thank you for your solution. I didn't make it clear that I want to
>find a word not ending with 's'. the 'john's' is a specical case
>ending with 's', but i can not come up with a correct Regex not
>picking it up.
>On Nov 8, 2007 4:36 PM, Alan Churchill <email@example.com> wrote:
>> Tested using RegexBuddy.
>> Alan Churchill
>> -----Original Message-----
>> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Yu
>> Sent: Thursday, November 08, 2007 3:19 PM
>> To: SAS-L@LISTSERV.UGA.EDU
>> Subject: Re: Regex solution needed.
>> sorry I posted a wrong testing code. this is what i am tring to show,
>> data test;
>> if _n_ = 1 then re = prxparse('/\b(\w*(?<!s))\b/');
>> retain re;
>> infile cards truncover;
>> input string $20.;
>> pos=prxmatch(re, string);
>> if pos then match = prxposn(re, 1, string);