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 (March 2005, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 15 Mar 2005 17:12:45 -0500
Reply-To:     "Chang Y. Chung" <chang_y_chung@HOTMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Chang Y. Chung" <chang_y_chung@HOTMAIL.COM>
Subject:      Re: What is the regular expression for SAS format name?
Comments: To: "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>

On Tue, 15 Mar 2005 16:24:55 -0500, Richard A. DeVenezia <radevenz@IX.NETCOM.COM> wrote:

>Chang: > >I think your pattern is missing some endpoint conditions, specifically one >character format names. >The following is more robust, but for the sake of me, I could not get the \1 >backticking to perform as I supposed it would. (e.g. when I replace a later >([A-Za-z_]) with \1 to resuse the first subpattern, the matches dont come >out as expected)

Hi, Richard,

You are absolutely correct. My pattern is still not correct. Yours is. I could not make the back referencing work, either. Hmmmm... :-(

I was able to factor out the beginning and ending of the string. I am using a non-capturing parens here, but regular parens work also.

pattern= '/^(?:' || '[A-Za-z_]' || '|' || '[A-Za-z_]\w{0,30}[A-Za-z_]' || '|' || '\$[A-Za-z_]' || '|' || '\$[A-Za-z_]\w{0,29}[A-Za-z_]' || ')\s*$/' ;

Cheers, Chang


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