Back to all patterns
Canadian Postal Code
Validation
Validates a Canadian postal code (A1A 1A1).
/^[ABCEGHJ-NPRSTVXY][0-9][A-Z] ?[0-9][A-Z][0-9]$/iHow it works
Six characters alternating letter-digit-letter-digit-letter-digit, with an optional space after the third. The first letter excludes D, F, I, O, Q, U, W, Z.
Test Cases
Should Match
- K1A 0B1
- M5V3L9
- H0H 0H0
Should NOT Match
- 123 456
- K1A 0D1Z
- D1A 0B1
Quick Summary
Validates a Canadian postal code (A1A 1A1, space optional).