Regular Expressions 101

Valid Telephone Number

Open Workspace
  • JavaScript
  • Match
10

Regular Expression

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

Description

This regex validates varying types of telephone numbers.

Submitted by Adam Recvlohe