Regular Expressions 101

E.164 ITU Telephony Standard including Extensions

Open Workspace
  • PCRE2 (PHP)
  • Match
1

Regular Expression

/
^\+[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