Regular Expressions 101

Community Patterns

Simple telephone regex

1

Regular Expression
PCRE (PHP <7.3)

/
^\+?[0-9]{1,3}-*\(*[0-9]{1,3}\)*-*\d{2}-*\d{2}$
/

Description

Includes simple country and city code, regex will only work for 7 digit telephone numbers in following formats: +xxxxxxxxxx +x(xxx)xxxxxx +xxx(xxx)xxx-xx-xx

Submitted by Jacob - 8 years ago