Vaildate Zip Code Using a Regular Expression
Posted on 2004-10-10
Hello, I would like to validate a zip code using a regular expression. The zip code must be in one of two formats.
The first is:
nnnnn where n is any digit including zero. 5 digits are required (they must all be numbers)
The second is:
nnnnn-nnnn where n is any digit including zero. this MUST have the hypen between the fifth and seventh character and there must be 5 numercial values to the left of the hypen and four numerical values to the right of the hypen.
Thanks for your help, sorry I'm bad at these :-)