Regular Expressions 101

Community Patterns

Phone Number

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. - 8 years ago