ZIP code (US postal code) regular expression can be used to verify if a given string contains a valid ZIP code or extract ZIP code from a string. Supports both 5-digit and 9-digit (ZIP+4) formats.
A regular expression to test a string against ZIP code format:
True
False
Enter a text in the input above to see the result
Example code in PHP:
True
False
Enter a text in the input above to see the result
True
False
Enter a text in the input above to see the result
This ZIP code regex has several limitations:
Discover UI Bakery – an intuitive visual internal tools builder.