zip code validation pattern. For a more detailed introduction to HTML5 form validation you can find some great articles linked. The above code displays an input box as follows . As mentioned above, we can improve on this by making use of the pattern attribute which . Validate ZIP code Regular Expression « Development Class « C / C Sharp Formal Validation of Pattern Matching Code Claude Kirchner, Pierre-Etienne Moreau, Antoine Reilles To cite this version Note that the validation only happens on those fields that are visible, since. Zip Code Please enter a valid American postal code. 13 Apr 2012. li input type text name zip required pattern 0-9 6 / /li li class help required. Indian Postal Code format only- six digit number. JavaScript - Zip Code Validation/formatting - Free JavaScript Tutorials, Help, Tips, Tricks, and More. You can check that a user s entry matches a predefined pattern, such as a phone number, postal code, e-mail address, and so on. To do so, you use a regular expression.