1 Jan 2011 01:09
Re: Regex for telephone numbers
Jim Lucas <lists <at> cmsws.com>
2011-01-01 00:09:51 GMT
2011-01-01 00:09:51 GMT
On 12/29/2010 4:35 PM, Daniel P. Brown wrote: > On Wed, Dec 29, 2010 at 19:12, Ethan Rosenberg <ethros <at> earthlink.net> 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. > > Congrats. People in Hell would like ice water. Now we all know > that everyone wants something. ;-P > > Really, this isn't a PHP question, but rather one of regular > expressions. That said, something like this (untested) should work: > > <?php > > $numbers = array( > '123-456-7890', > '2-654-06547', > 'sf34-(Continue reading)asdf-', > 'abc-def-ghij', > '555_555_5555', > '000-000-0000', > '8007396325', > '241-555-2091', > '800-555-0129', > '900-976-739',
RSS Feed