Regular Expressions 101

Community Patterns

US Phone Checker

0

Regular Expression
ECMAScript (JavaScript)

/
^(\d*)?([ ])?((\d{3})|\(\d{3}\))([- ])?(\d{3})([- ])?(\d{4})$
/
mg

Description

I assures input phones are formated matching certain criteria like pearing parenthesis or correct spacing. It does not check if other number instead of 1 is introduced for international prefix. I'm learning english so suggestions are welcomed for both regex and this description itself. :)

Submitted by anonymous - 2 years ago