This regex pattern validates residential Canadian postal codes. It starts with a letter from the set [ABCEGHJKLMNPRSTVXYabceghjklmnprstvxy] (excluding D, F, I, O, Q, U, W, Z), followed by a digit, then a letter (case insensitive). There is a space, followed by a digit, a letter (case insensitive), and another digit. This ensures the format 'A1A 1A1' is followed with the restrictions mentioned.
Interactive Regex Playground
^[ABCEGHJKLMNPRSTVXYabceghjklmnprstvxy]\d[A-Za-z] \d[A-Za-z]\d$
This regex pattern validates residential Canadian postal codes. It starts with a letter from the set [ABCEGHJKLMNPRSTVXYabceghjklmnprstvxy] (excluding D, F, I, O, Q, U, W, Z), followed by a digit, then a letter (case insensitive). There is a space, followed by a digit, a letter (case insensitive), and another digit. This ensures the format 'A1A 1A1' is followed with the restrictions mentioned.
Matches
Found 0 matches