Re: Regular Expression Help

From: Date: Tue, 22 May 2001 18:36:26 +0000
Subject: Re: Regular Expression Help
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-53893@lists.php.net to get a copy of this message
On Tue, 22 May 2001 10:44:42 -0700, Jason Caldwell (jason@thinkingman.org) wrote: >I'm trying to figure out how to "say" with a Regular Expression how >to check >for the following characters in a phone number: > >( ) - > >with a length between 1 and 20 -- > >I've tried the following and it doesn't seem to work. > >eregi("^([0-9]|\\(|\\)|\\-){1,20}$") oops, make that: "^[0-9\\(\\)-]{1,20}$" note: you don't have to escape the - when its the last char in the range >I'm not interested in checking for a completely valid phone >number... but >instead checking to see if the phone number is numbers with or >without the >( ) - characters. Plus, I think creating a Regex expr that can check >for US >and International formats would be too complex. > >Thanks. >Jason > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net >For additional commands, e-mail: php-general-help@lists.php.net >To contact the list administrators, e-mail: php-list- >admin@lists.php.net

« previous php.general (#53893) next »