Created
May 4, 2017 16:03
-
-
Save leongaban/4043c26c4ab0f5585169a1e8635d4775 to your computer and use it in GitHub Desktop.
Validate Zipcode in Javascript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://stackoverflow.com/questions/160550/zip-code-us-postal-code-validation | |
const validZipcode = (zipcode) => zipcode.match(/(^\d{5}$)|(^\d{5}-\d{4}$)/); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment