Title |
Test
Find
Canada postal code
|
Expression |
^[ABCEGHJKLMNPRSTVXYabceghjklmnprstvxy]{1}\d{1}[A-Za-z]{1}\d{1}[A-Za-z]{1}\d{1}$ |
Description |
Matches the Canadian postal code with no space between. |
Matches |
M4S1G9 | m6p1l1 | m4s1G9 |
Non-Matches |
M4S 1G9 | m6p 1l1 | m4s 1G9 |
Author |
Rating:
Nassim Ghods
|
Source |
|
Your Rating |
|
Title: space and dash
Name: Tony
Date: 5/16/2009 10:49:31 PM
Comment:
It should handle space or dash in the postal code. Here is my revised expression:
^[ABCEGHJKLMNPRSTVXYabceghjklmnprstvxy]{1}\d{1}[A-Za-z]{1}( |-)?\d{1}[A-Za-z]{1}\d{1}$