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 (November 2007, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 29 Nov 2007 21:20:43 -0600
Reply-To:     "data _null_," <datanull@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "data _null_," <datanull@GMAIL.COM>
Subject:      Re: End of string bug in regular expression?
Comments: To: Alex <internalsu@hotmail.com>
In-Reply-To:  <53d42045-1e8a-4c5f-86b5-50b9093065bb@s8g2000prg.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1

I don't have SAS this evening so I cannot provide code. The LENGTH function returns the "trimmed" length of a string. Compare that to the VLENGTH function that returns the length of the variable. Notice that x = 'a/b/d/d.java ' in the code I posted has one trailing space at the end. In the case VLENGTH(x) eq LENGTH(X)+1.

On Nov 29, 2007 8:37 PM, Alex <internalsu@hotmail.com> wrote: > On Nov 29, 12:11 pm, datan...@GMAIL.COM ("data _null_,") wrote: > > Not a bug. > > > > Okay I'll put it in a program. You need to learn about fix length > > character strings. Its a SAS thing. > > > > 266 data _null_; > > 267 do x = 'a/b/c/d.java '; > > 268 y = prxmatch('/[\\\/]?([^\s]+[\\\/])*([\w.]+)[.](\w+)/',x); > > 269 z = prxmatch('/[\\\/]?([^\s]+[\\\/])*([\w.]+)[.](\w+)$/',x); > > 270 zT = prxmatch('/[\\\/]?([^\s]+[\\\/])*([\w.]+)[.](\w+)$/',trim(x)); > > 271 put (_all_)(=); > > 272 end; > > 273 run; > > > > x=a/b/c/d.java y=1 z=0 zT=1 > > > > On Nov 28, 2007 9:34 PM, Alex <interna...@hotmail.com> wrote: > > > > > > > > > a/b/c/d.java > > > > > to match it, prxmatch returns true with > > > > > [\\\/]?([^\s]+[\\\/])*([\w.]+)[.](\w+) > > > > > but false with [\\\/]?([^\s]+[\\\/])*([\w.]+)[.](\w+)$ > > > > > in other perl lib, the $ returns true as well.- Hide quoted text - > > > > - Show quoted text - > > My program is a little bit long. The string to match is from another > dataset. Like you all said, the magic is to trim before matching. But > I have tested every string, its length shows there's no blanks after. > So I don't know why the trim helps here? >


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