Re: validate international phone numbers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Merlin wrote:

Hi,

I am trying to validate international phone numbers before adding into a db.
After a bit of research I came up with this regex:


return (ereg('^[0-9]{1,3}\.[0-9]{1,6}\.[0-9]{1,8}$', $phone));
However, this tightens the numbers to something like this: 409.711.933838


Thats a problem, since some countries have complete other formats and some peopole place a + in front and a : instead of . or even just the number.

Can anybody recommend a good regex to validate this? I am not to good at creating regex :-(

Strip out all non-numerical characters before you process.

Sincerely,

Joshua D. Drake


Thanx for any help,

Merlin



--
Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC
Postgresql support, programming shared hosting and dedicated hosting.
+1-503-667-4564 - jd@xxxxxxxxxxxxxxxxx - http://www.commandprompt.com
PostgreSQL Replicator -- production quality replication for PostgreSQL


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux