Regular Expressions 101

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
^(\+[0-9]{2}[.\-\s]?|00[.\-\s]?[0-9]{2}|0)([0-9]{1,3}[.\-\s]?(?:[0-9]{2}[.\-\s]?){4})$
/
gm

Description

Will match any French phone number, without or with separators (. - space), with or without international notation (+33 or 0033). 1st subgroup captures 0, +nn or 00nn 2nd subgroup captures the rest of the phone number

Examples: 0512345678 05 12 34 56 78 05.12.34.56.78 05-12-34-56-78 +33512345678 +335 12 34 56 78 +335.12.34.56.78 +335-12-34-56-78 0033512345678 00335 12 34 56 78 00335.12.34.56.78 00335-12-34-56-78

Submitted by Gabriel Hautclocq - 7 years ago