RegEx to Match a US zip code or Candian postal code - somewhat strict

This RegEx introduces stricter requirements for the first letter in the Canadian postal code. Although, it does allow the use of lowercase letters.
(^\d{5}(-\d{4})?$)|(^[ABCEGHJKLMNPRSTVXYabceghjklmnprstvxy]{1}\d{1}[A-Za-z]{1} *\d{1}[A-Za-z]{1}\d{1}$)
Posted by
Snippet Viewed 1967 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