Re: Regex for telephone number
| From: | Alex Black | Date: | Mon, 15 Jan 2001 21:59:44 +0000 |
| Subject: | Re: Regex for telephone number | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-34689@lists.php.net to get a copy of this message | ||
case "phone_us":
if(ereg("^([2-9][0-9]{2})([2-9][0-9]{2})([0-9]{4})$", $var)){
return TRUE;
}else{
set_stringtypes_error(throw_error3("lib_string_types_108", $var));
}
break;
case "phone_int":
if(!preg_match("/[^0-9\(\)\-\. ]/", $var)){
return TRUE;
}else{
set_stringtypes_error(throw_error("lib_string_types_109", $var));
}
break;
works good for us.
that's from the stringtypes lib in binarycloud. we're going to convert all
of that stuff to be stored as rules in XML... groovy changes are afoot!
_alex
--
Alex Black, Head Monkey
enigma@turingstudio.com
The Turing Studio, Inc.
http://www.turingstudio.com
vox+510.666.0074
fax+510.666.0093
Saul Zaentz Film Center
2600 Tenth St Suite 433
Berkeley, CA 94710-2522
> From: vikram@w-o-i.com (Vikram Vaswani)
> Newsgroups: php.general
> Date: 15 Jan 2001 04:23:51 -0800
> Subject: [PHP] Regex for telephone number
>
> Hi!
>
> Can someone help me out with a regex to validate a phone number?
>
> Thanks
>
> Vikram
>
> --
> 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
>