Re: [PHP-DB] Re: [PHP] Regex for telephone numbers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You could also help them out a little with something like..

$phone = str_replace("(", "", $phone);
$phone = str_replace(")", "-", $phone);

HTH,

Karl


On Dec 29, 2010, at 6:27 PM, Josh Kehn wrote:



On Dec 29, 2010, at 7:12 PM, Ethan Rosenberg <ethros@xxxxxxxxxxxxx> wrote:

Dear List -

Thank you for all your help in the past.

Here is another one....

I would like to have a regex which would validate that a telephone number is in the format xxx-xxx-xxxx.

Thanks.

Ethan

MySQL 5.1  PHP 5  Linux [Debian (sid)]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


You can't, phone numbers are more complex then that. You could use \d{3}-\d{3}-\d{4} to match that basic pattern for all numbers though.

Regards,

-Josh
___________________________
http://joshuakehn.com
Sent from my iPod
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux