Quantcast
Channel: Kushal's Java Blog | Software Engineering Blog » Java Regular Expressions - Kushal's Java Blog | Software Engineering Blog
Viewing all articles
Browse latest Browse all 12

Regular Expression to validate the US zip codes

$
0
0

Here is a Regular Expression to validate the united states 5 and 9 digit zip codes:

^\d{5}(-\d{4})?$

Basic Validations:
• First five letters should be digits.
• It can be followed by a dash and optional 4 digits

Originally posted 2011-04-30 18:18:09.

Share


Viewing all articles
Browse latest Browse all 12

Trending Articles