Re: Phone number validation
| From: | tedd | Date: | Sun, 12 Mar 2006 22:19:56 +0000 |
| Subject: | Re: Phone number validation | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-231816@lists.php.net to get a copy of this message | ||
Paul:
Also check out:
http://www.weberdev.com/get_example-3605.html
tedd
Hi all, I am trying to validate phone numbers in a web form that I have created. I am using a regular expression to validate the phone number. It seems when I enter the phone number in the following ways I get errors (123) 456 7890 123 456 7890 (123) 456 - 7890 123 456-7890 I am using the ereg method in php to test the regular expression. Here is the Regular Expression that I am using to test against potential phone numbers $validPhone = "^([0-9]{3}[ ]*)?[0-9]{3}[ ]*[0-9]{4}$"; By the way The phone numbers are in US format. If anyone can help me with this I would really appreciate it. Thanks, Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php-- -------------------------------------------------------------------------------- http://sperling.com