Regular Expressions 101

Community Patterns

Phone number

1

Regular Expression
PCRE (PHP <7.3)

/
^\(?([0-9]{3})\)?([ .-]?)([0-9]{3})\2([0-9]{4})$
/

Description

U.S. Phone number with optional area code.

Submitted by anonymous - 9 years ago