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 2006, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 28 Nov 2006 15:36:49 -0500
Reply-To:     evilpettingzoo97@AOL.COM
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Ken Borowiak <evilpettingzoo97@AOL.COM>
Subject:      Re: Regex pattern to match *-*-* ?
Comments: To: jack.pistons@GMAIL.COM
In-Reply-To:  <1164742806.822235.185900@j72g2000cwa.googlegroups.com>
Content-Type: text/plain; charset="us-ascii"

Jack & All,

The masking of '-' can be skipped if it appears first in the character class, or second if preceeded by the '^' (i.e. a negated character class). Otherwise, it must be masked, as it is used to indicate a range.

Ken

-----Original Message----- From: jack.pistons@GMAIL.COM To: SAS-L@LISTSERV.UGA.EDU Sent: Tue, 28 Nov 2006 2:40 PM Subject: Re: Regex pattern to match *-*-* ?

Hi, Richard:

Try the following Perl regex:

[^\- ]+(-[^\-]+)+

The hyphen has meaning within the character class and needs to be escaped.

- Jack

Richard A. DeVenezia wrote: > Trying to figure out a single regex pattern that will indicate data is of > the form: > something dash something > with any number of trailing dash somethings > > Tried > [^-]+(-[^-]+)+@ > > but it is not affirming a match against data like > a-b-c > xx-yy-zz > 2-3 > a-b-c-d-e-f > > Any ideas? > > -- > Richard A. DeVenezia

________________________________________________________________________ Check out the new AOL. Most comprehensive set of free safety and security tools, free access to millions of high-quality videos from across the web, free AOL Mail and more.


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