Five Habits for Successful Regular Expressions
Subject:   Even better way of validating phone numbers
Date:   2004-01-24 10:06:09
From:   developers_coach
Here is a better way to validate phone numbers:


As a resident of the UK I have on several occasions run foul of web site registration pages that insist on you entering a valid US phone number, regardless of whether you live in the US or not. I usually end up entering a totally spurious number just so that I can progress to the next screen. Even if someone is a resident of the USA, they may want to give you their mobile phone number, or a switchboard extension, or want to add additional information such as "after 6pm".

Unless you have a real cast-iron reason for ensuring that a phone number is valid, then checking for US number formats is both parochial and short sighted.