note 43843 added to function.preg-match
| From: | ebiven at rn2 dot php dot net | Date: | Tue, 06 Jul 2004 05:53:00 +0000 |
| Subject: | note 43843 added to function.preg-match | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-72684@lists.php.net to get a copy of this message | ||
To regex a North American phone number you can assume NxxNxxXXXX, where N = 2 through 9 and x = 0
through 9. North American numbers can not start with a 0 or a 1 in either the Area Code or the
Office Code. So, adpated from the other phone number regex here you would get:
/^[2-9][0-9]{2}[-][2-9][0-9]{2}[-][0-9]{4}$/
----
Manual Page -- http://www.php.net/manual/en/function.preg-match.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+43843
Delete -- http://master.php.net/manage/user-notes.php?action=delete+43843&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+43843&report=yes
Search -- http://master.php.net/manage/user-notes.php