Regular Expressions 101

Community Patterns

Spanish phone number

0

Regular Expression
PCRE (PHP <7.3)

/
^((\+34[\s])|(\(\+34\)[\s]?))?[9|8|7|6][0-9]{2}([0-9]{6}|([\s][0-9]{3}){2}|([\s][0-9]{2}){3})$
/
g

Description

This regex includes the +34 or (+34) or not, and all combinations like xxxxxxxxx, xxx xxx xxx, xxx xx xx

Submitted by anonymous - 7 years ago