Regular Expressions 101

Community Library Entry

14

Regular Expression
ECMAScript (JavaScript)

/
^([+]?\d{1,2}[-\s]?|)\d{3}[-\s]?\d{3}[-\s]?\d{4}$
/

Description

Allows phone numbers with optional country code, optional special characters and whitespace

Submitted by Tlmader - 9 years ago