Date: Fri, 10 Sep 2010 15:39:12 -0500
Reply-To: Joe Matise <snoopy369@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Joe Matise <snoopy369@GMAIL.COM>
Subject: Re: parsing text
In-Reply-To: <201009102029.o8AJmekO006723@malibu.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1
I agree in this particular instance SCAN is superior. However, REGEXs are
quite handy for other things. As Paul/Mikeeeee/etc. would say, the best
tool is the tool that solves the current problem. :)
-Joe
On Fri, Sep 10, 2010 at 3:29 PM, Tom Abernathy <tom.abernathy@gmail.com>wrote:
> I am reminded again why have never spent much time learning this regular
> expression stuff. Most of the problems I deal with are like this example
> where the existing SAS functions are not only more efficient, but easier to
> understand.
>
> scan(the_source_string,-1,'()')
>
> versus
>
> > prxparse('/.*?\((.*)\).*/') as prxm,
> > case when prxmatch(calculated prxm,the_source_string) then
> > prxposn(calculated prxm , 1, the_source_string ) else ' '
> > end
>
|