Pattern: Zip Code
Patterns for matching postal/zip codes
ttheIntuitionist3/26/2025
Patterns
Regular Expressions
^[0-9]{5}(?:-[0-9]{4})?$
ttheIntuitionist3/26/2025
Matching Strings
| Matches? | Text | Description | Author |
|---|---|---|---|
| 12345 | Basic 5-digit format | ttheIntuitionist | |
| 12345-6789 | ZIP+4 format | ttheIntuitionist |
Non-matching Strings
| Matches? | Text | Description | Author |
|---|---|---|---|
| 1234 | Too few digits | ttheIntuitionist | |
| 123456 | Too many digits | ttheIntuitionist | |
| 12345-123 | Invalid ZIP+4 format | ttheIntuitionist |