Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
^\d{3}-\d{3}-\d{4}$
/
gm

Description

Such as 333-333-1234.

Does not test for valid sequences of digits. E.g. 000-000-0000 would pass.

Submitted by anonymous - 9 years ago