[tpm] Regex to validate (international) phone numbers
janes.rob at gmail.com
Mon Aug 6 15:17:17 PDT 2007
-----BEGIN PGP SIGNED MESSAGE-----
011 country-code zone-code phone-number
that's the syntax. country code is 1-3 digits. zone-codes are like
areacodes in north america, but they aren't necessarily geographic in
nature. they may represent cellphone or marine districts which are
telcordia distributes an up-to-date list which is used for switching
equipment. probably $500/month.
each country code has it's own set of zone codes.
the caribbean and various us protectorates are countries that fall in 1+
the further you go past 011 the more dependent you become on a
the attached country code list is out of date. czechoslovakia for
example is no longer 42, it has split into 420 and 421.
Madison Kelly wrote:
> Thanks Andy and Liam!
> Number::Phone was more than I needed, but the 'is_valid' function
> gave me enough of a pointer to work out something I think will work. As
> for extensions, I have a separate DB column for that.
> What I do is check for the leading '+' (as this is needed by some
> mobile GSM phones), strip off all non-digit characters, then check the
> length. Well, I check a little more than that, but ultimately it comes
> down to length. Then I can "clean up" the number to something standard
> before saving it.
> That had enough info for me to feel comfortable that I can identify
> *most* international numbers. As for "evenings only" or alternative
> numbers, info like that will have to go in the comments section. The
> number asked for is simply "preferred number" so I have *something* on
> Thanks both!
> toronto-pm mailing list
> toronto-pm at pm.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the toronto-pm