I had to spent more time than I wished I would spend last weekend trying to find a RegEx that would validate US and Canadian postal codes for me.   So here for the record, are the regular expression strings that I was looking for

^[ABCEGHJKLMNPRSTVXY]{1}\d{1}[A-Z]{1} *\d{1}[A-Z]{1}\d{1}$
Matches Canadian PostalCode formats with or without spaces (e.g., "T2X 1V4" or "T2X1V4")

Matches all US format zip code formats (e.g., "94105-0011" or "94105")

(^\d{5}(-\d{4})?$)|(^[ABCEGHJKLMNPRSTVXY]{1}\d{1}[A-Z]{1} *\d{1}[A-Z]{1}\d{1}$)
Matches US or Canadian zip codes in above formats.