^\d{5}-\d{4}|\d{5}|[A-Za-z]\d[A-Za-z] \d[A-Za-z]\d|[A-Za-z]\d[A-Za-z]\d[A-Za-z]\d$
RegEx to Match a US zip code or Candian postal code
Matches 5 or 9 digit US, with or without a space on Canadian, upper or lowercase
Snippet Viewed 1704 times.
Share your RegEx code snippets:
- Get some recognition & a link back to your site.
- Create your own code library.
- Help your fellow developers, as they have helped you.
Related Articles