Phone Validator
object PhoneValidator
Content copied to clipboard
Contains helper methods to verify validity of phone numbers, in various formats.
Some examples of valid phone numbers are:
"5233123298", // plain 10 digit
"12543240573", // 1 prefix
"1 254 353 5028", // with spaces
"1 (634) 234-8563", // with parenthesis, spaces, dashes
"(634)2325937", // parenthesis, no spaces
"937-273-0936", // only dashes
"932 323-7362" // space and dash
Some examples of invalid phone numbers are:
"52331232982", // too many numbers
"532734333", // too few numbers
"1234539563", // area code starts with 1
"0234659372", // area code starts with 0
"593 673 2846", // 2nd digit in area code cannot be 9
"(253) 144-8392", // 1st digit in 7-digit number cannot be 1
"(253) 012-4856" // 1st digit in 7-digit number cannot be 0
Functions
Properties
VALIDATION_REGEX
Link copied to clipboard