Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
ECMAScript (JavaScript)

/
(?:[(]?\d{3}[)]?)?\s*\d{3}(\-|\s)?\d{4}\s*
/
g

Description

Matches phone #s (aaa) bbb-cccc aaa bbb cccc aaabbbcccc and such.

Submitted by Zach - 9 years ago