Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
ECMAScript (JavaScript)

/
^(((((\+)|(00))[1-9][0-9]{0,2})?( )?)|(0))[1-9][0-9 ]{5,}$
/
gm

Description

Telephone number

strict international section :- starting with '+' or '00' flexible local section for wider international and allows spaces for visual formatting

Close enough for many requirements. Tweak to match your country/circumstances better.


Matches:

+1 123456 001 123456 001123456 +1123456 +32 123456 +32 123 456 0032 123456 +32 123 456 +32123456 00354 123456 +354 123456 +354123456


Submitted by PS - 5 years ago