Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
^\d{3,5}([- ]?\d{4})?$
/
gm

Description

5 or 9 Digit US Zip codes with optional hyphen or space separator.

Submitted by anonymous - 7 years ago