Regular Expressions 101

Phone Number

Open Workspace
  • JavaScript
  • Match
1

Regular Expression

/
^\(\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.