nanp
Test if a string is a North American Number Plan (phone) number.
usage
var nanp = ; ; // returns true; // returns true; // returns true; // returns true; // returns true; // returns true ; // returns false; // returns false; // returns false
You can also use nanp
's internal strip
function to clean strings, removing formatting as well as the country code "1" or "+1":
var clean = nanp; // -> 9372521234
Learn more: http://en.wikipedia.org/wiki/North_American_Numbering_Plan