Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
(?:\+?(?<COUNTRY_CODE>\d{1})?-?\(?(?<AREA_CODE>\d{3})\)?[\s-\.]?)?(?<PART1>\d{3})[\s-\.]?(?<PART2>\d{4})[\s-\.]?
/
gm

Description

US numbers only

Submitted by codedude - 9 years ago