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
^\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$
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.

 

Submit | Browse

Most Recent regex snippets

Most Viewed