Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
ECMAScript (JavaScript)

/
^(\d{10,21})|(\+\d{1,3}|\d{1,4}|\(\+\d{1,3}\)|\(\d{1,2}\))(([ -.]\d+){1,5}$|([ -.]\d+){1,5}([ -.](ext\.|x|extention))[ -.]\d{1,5}$)
/
gm

Description

I don't know how many times I found some regex online that just didn't work. Finally decided to write my own that actually works for some of our customers around the world.

Submitted by Alexei Yagolnikov - 8 years ago