Regular Expressions 101

Community Patterns

Community Library Entry

10

Regular Expression
ECMAScript (JavaScript)

/
(^(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 - 9 years ago