LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (September 2007, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 18 Sep 2007 13:10:30 +0000
Reply-To:   toby dunn <tobydunn@HOTMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   toby dunn <tobydunn@HOTMAIL.COM>
Subject:   Re: Text to REGex Converter for RPXMATCH
Comments:   To: EvilPettingZoo97@AOL.COM
In-Reply-To:   <200709180329.l8HHeOWr025597@malibu.cc.uga.edu>
Content-Type:   text/plain; format=flowed

Ken ,

.....Probably not horribly difficult

Well that largely depends on a couple of factor like how ugly is the pattern to be generated and how efficient does it need to be. If all the patterns are as elementry as the example no it wouldnt be taht difficult to create the pattern with enough data step code. However, as the complexity increases so will the amount fo code that is needed. Crafting RegEx is all about knowing your data, it requires the programmer to be part artist and part mad scientist. I doubt that SAS is the right tool to even attempt create a routine or program to do this with any sort of efficiency, beyond very simple cases.

Toby Dunn

Compromise is like telling a lie, it gets easier and easier. Each comprimise you make, that becomes your standard.

Perfection doesnt exist, once you reach it, its not perfect anymore. It means something else.

From: Ken Borowiak <EvilPettingZoo97@AOL.COM> Reply-To: Ken Borowiak <EvilPettingZoo97@AOL.COM> To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Text to REGex Converter for RPXMATCH Date: Mon, 17 Sep 2007 23:29:22 -0400

On Mon, 17 Sep 2007 22:53:34 -0400, Lingqun Liu <lingqun@GMAIL.COM> wrote:

>I don't think there is such "intelligent" function existing because a >given string can be match by more than one (even tons) of regular >expression. > >Best, > >LL >

LL,

Based on your response, I think I see what the poster is after. From a string, generate a pattern. Probably not horribly difficult, just replace 0-9 with \d, alpha characters with [[:alpha:]], backwhack the metacharacters, and leave the other characters alone. Now cases where digits can be interchanged with alpha characters may require additional rules.

A user-defined function could be coded with PROC FCMP in V9.2.

KBueno

>On 9/17/07, junkmail115@gmail.com <junkmail115@gmail.com> wrote: >> Is there a function in SAS that would take a string value and check >> it's RegEX format against another string field? >> >> Something like: >> >> #1 %LET ZIP9RegEX=[function?](53703-1234); >> #2 ZipTest=RPXMATCH(&ZIP9RegEX, ZIPVariable); >> >> After compiling<not positive about the terminology here> line #2 would >> read: ZipTest=prxmatch('/\d{5}-\d{4}/', ZIPVariable); >> >> So ZipTest would be a binary value where 0=Unmatched and 1=Matched. >> >> >> Thanks, >> Aaron >>

_________________________________________________________________ Discover sweet stuff waiting for you at the Messenger Cafe. Claim your treat today! http://www.cafemessenger.com/info/info_sweetstuff.html?ocid=TXT_TAGHM_SeptHMtagline2


Back to: Top of message | Previous page | Main SAS-L page