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
[EMAIL PROTECTED]

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: [EMAIL PROTECTED] (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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to