Re: regular expression
| From: | Rénald CASAGRAUDE | Date: | Tue, 19 Mar 2002 20:15:15 +0000 |
| Subject: | Re: regular expression | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-89192@lists.php.net to get a copy of this message | ||
Kris Vose wrote:
>
> How would you write a regular expression that defines a phone number: ex. (123)123-1234.
>
> In other words how would you check to see if there were three numerics surrounded by (), then
> three numerics with a "-", then four numerics.
with posix regular expression, for example :
$pattern = "\([0-9]{3}\)[0-9]{3}\-[0-9]{4}";
or
$pattern = "\([0-9]{3}\)[0-9]{3}-[0-9]{4}";
(i m not sure for the -)