Regular Expressions 101

Community Patterns

International Phones Validation

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 - 7 years ago