piighost/ca-postal
Canadian postal code, letter digit letter then digit letter digit. The letter classes drop D, F, I, O, Q and U, which Canada Post never uses because they read as digits, so the shape alone is already selective.
Label: CA_POSTAL
Pattern (?<!\w)[A-CEGHJ-NPR-TVXY]\d[A-CEGHJ-NPR-TV-Z]\s?\d[A-CEGHJ-NPR-TV-Z]\d(?!\w)
Must be caught Ottawa, K1A 0B1 for the mail room. → K1A 0B1Postal code H3Z2Y7 in Montreal. → H3Z2Y7
Must be left alone Postal code D1A 0B1Postal code K1A 0B
Tags: ca, location, contact
Download the detector as TOML
Used by
piighost/ca — Canada: postal code and social insurance number.
Related patterns
piighost/ar-phone — Argentine phone number, the +54 country code or the 0 trunk prefix then ten or eleven digits.
piighost/ar-postal — Argentine CPA postal code: a province letter, four digits for the town, then three letters for the block side.
piighost/at-phone — Austrian phone number, the +43 country code or the 0 trunk prefix then six to thirteen digits, since Austrian…
piighost/au-phone — Australian phone number: the +61 or leading 0 prefix, a single area or service digit, then eight digits.
piighost/au-postal — Australian postal code, anchored on the state or territory abbreviation that precedes it in an address.
piighost/be-phone — Belgian phone number, the +32 country code or the 0 trunk prefix then eight or nine digits.
← piighost/ca-passport · All patterns in the catalogue · piighost/ca-sin →