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 2006, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 31 Mar 2006 13:01:16 -0500
Reply-To:     evilpettingzoo97@AOL.COM
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Ken Borowiak <evilpettingzoo97@AOL.COM>
Subject:      Re: How to Under the follow Perl
Comments: To: jamespannyc@YAHOO.COM
In-Reply-To:  <200603311706.k2VGFZ9I002958@mailgw.cc.uga.edu>
Content-Type: text/plain; charset="us-ascii"; format=flowed

James,

In example 1 where you find \( in the PAREN regex, where the \ character is masking the open parens character. In example 3 you find \((, where \( is the same as above and the second ( starts the beginning of a capture buffer used later in the example.

Does this answer your first question?

HTH, Ken

-----Original Message----- From: James Pan <jamespannyc@YAHOO.COM> To: SAS-L@LISTSERV.UGA.EDU Sent: Fri, 31 Mar 2006 12:06:28 -0500 Subject: How to Under the follow Perl

Hi,

I am learning Perl through SAS website.

Under Pattern Matching Using SAS Regular Expressions (RX) and Perl Regular Expressions (PRX)

Example 3: Extracting a Substring from a String

paren = "\(([2-9]\d\d)\) ?[2-9]\d\d-\d\d\d\d"; dash = "([2-9]\d\d)-[2-9]\d\d-\d\d\d\d";

1. Why paren and dash is different from Example 1? Why need \(( rather than just |( ?

2. Use the PRXPAREN function to determine which submatch to use. PRXPAREN returns the last submatch that was matched. If an area code matches the form (XXX), PRXPAREN returns the value 2. If an area code matches the form XXX, PRXPAREN returns the value 4. How to get 2 and 4? Could anyone explain it in detail? I can not get there.

Thanks, James


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