One Regular Expression to validate US and Canada ZIP / Postal Code
问题 I am developing a stationery program. Customers have choice to pick their region either US or Canada. When they enter address they have to enter ZIP/Postal code. I am trying to validate field but I cannot use reg exp either for US or Canada. I require a regular expression that validates for both country zip code. 回答1: Not knowing what language you're using, I will not use any abbreviations for character classes: ^[0-9]{5}$|^[A-Z][0-9][A-Z] ?[0-9][A-Z][0-9]$ Depending on your language, you