[thelist] FW: RegExp 1 or 2 digits

Tab Alleman Tab.Alleman at MetroGuide.com
Thu Sep 11 12:03:00 CDT 2003


Tab Alleman wrote:
> I want to create a RegExp pattern that will match this:
> 
> "FOR xx NIGHTS"
> 
> ...where xx could be either a 1 or 2 digit number.  There would not
> be a leading zero if it's one digit. 
> 
> I'm not sure if doing a multiple instance of a range is acceptable
> though.  I mean, 
> 
> [0-9]+
> 
> Might match to "11" but would it match to "12", or is it even legal
> at all? 
> 
> Is there a way to do what I want?  I can't tell from the Special
> Character libraries I've found. 

Doh.. Figured it out:

\d{1,2}


More information about the thelist mailing list