Regular Expressions 101

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

/
^[6789]\d{8}$
/
gm

Description

It validates the phone numbers for Spain, national calls. Only digit number format, without spaces, dots nor dashes.

This second version allows a empty string.

OK: 630222544 941641893 625233988 724903785 816794701

KO: 910 50 78 87 928-93-38-79 628238339 275766639 +34 969 97 22 01 792199000

Submitted by sajime - 3 years ago