Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
^(((1)?(\d{3})?(\d{7})$)|((1-)?(\d{3}?-)(\d{3})-(\d{4}))|(((1)?\((\d{3})\))?(\d{3})-?(\d{4})))$
/
A

Description

All Valid: 3334444 222333444 12223334444 333-4444 222-333-4444 1-222-333-4444 (222)3334444 (222)333-4444 1(222)3334444 1(222)333-4444

Submitted by anonymous - 9 years ago