Re: regular expression
| From: | Jason Wong | Date: | Tue, 19 Mar 2002 18:05:15 +0000 |
| Subject: | Re: regular expression | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-89169@lists.php.net to get a copy of this message | ||
On Wednesday 20 March 2002 01:53, Thalis A. Kalfigopoulos wrote:
> I guess you can do it also as:
>
> ([1-9]{3})[1-9]{3}-[1-9]{4}
But wouldn't this excludes zeros?
Try:
preg_match("/^\(\d{3}\)\s\d{3}-\d{4}$/", $number)
which matches
(123) 345-6789
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
/*
Your good nature will bring you unbounded happiness.
*/