Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
ECMAScript (JavaScript)

/
^\(\d{3}\)\s?\d{3}\-\d{4}$
/
m

Description

Allows a phone number in the following format: (123) 123-1234 The space is optional

Submitted by Tom G. - 9 years ago