Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
^\+?(39)?(0[\d+]{5,10})$
/
g

Description

Useful to discriminate italian geographic numbers from non geographic. Regex validates also the length (in digits) of the directory number Regex considers italian country code and + sign.

Italian numbers are considered geographic when are prefixed with 0.

Italian prefixes length is 2-4 digits long. Italian operators have 2-4 digits block of numbers assigned.

An italian geographic number ranges from 6 to 11 digits.

Submitted by Stefano Coletta - 7 years ago