[tpm] Regex to validate (international) phone numbers
linux at alteeve.com
Tue Jul 31 15:41:15 PDT 2007
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
More information about the toronto-pm