Title |
Test
Find
Canadian postal code format verification
|
Expression |
([ABCEGHJKLMNPRSTVXY][0-9][ABCEGHJKLMNPRSTVWXYZ])\ ?([0-9][ABCEGHJKLMNPRSTVWXYZ][0-9]) |
Description |
Accurate Canadian postal code format verification.
The format of a Canadian postal code is LDL DLD where L are alpha characters and D are numeric digits. But there are some exceptions. The letters D, F, I, O, Q and U never appear in a postal code because of their visual similarity to 0, E, 1, 0, 0, and V respectively. In addition to avoiding the six "forbidden" letters W and Z also do not appear as the first letter of a postal code (at least not at present). |
Matches |
M1R 4B0 | L0R 1B1 | L0R1B9 |
Non-Matches |
W1R 4B0 | L0R 1D1 | LOR1B9 |
Author |
Rating:
Vassilis Petroulias
|
Source |
|
Your Rating |
|
Title: Thanks
Name: Fellow Canadian
Date: 11/8/2008 12:18:19 PM
Comment:
Thanks for the regex, I just learned some details about Canadian Postal Codes that I didn't know about the exceptions your account for!