Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE2 (PHP >=7.3)

/
^\+[1-9][\d]{8,14}(;ext=[\d]{3,6})?$
/
gm

Description

Basic RegEx to catch ITU E.164 Formatted Telephone Numbers. Must include leading '+', first digit cannot be a zero, no other non-numeric characters -- with (optional) exception of Extensions denoted by ";ext=" and between 3 and 6 digits in the extension (adjust max to suit organization)

Submitted by ADWolf - 4 years ago