Skip to content

Regex for U.S. and Canadian Zip Codes

Below is the regex code for U.S. and Canadian zip codes. I’m don’t remember where I found these but hopefully someone finds them useful.

string _usZipRegEx = @"^\d{5}(?:[-\s]\d{4})?$";
string _caZipRegEx = @"^([ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ])\ {0,1}(\d[ABCEGHJKLMNPRSTVWXYZ]\d)$";
Published inC#

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *