in reply to phone number regex (new question)

die "or whatever" if /[^0-9()\- .]/;
Update: Escaped the hyphen. Thanks, revdiablo.

The PerlMonk tr/// Advocate

Replies are listed 'Best First'.
Re: Re: phone number regex (new question)
by revdiablo (Prior) on Mar 11, 2004 at 23:12 UTC

    I'd be careful with a character class like that. I haven't tested it, but the ')-' part might try to create a range starting at ')' and ending at ''. This is obviously not what was intended. Just to be safe, I'd be sure to put the '-' at the end of the character class.