• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Canadians - help me out - need to know what your postal codes look like!

notfred

Lifer
Would they match a regular expression like this: [0-9A-Za-z][0-9A-Za-z][0-9A-Za-z] [0-9A-Za-z][0-9A-Za-z][0-9A-Za-z] ?

that is, if X is any number or letter, a canadian po9stal code looks like "XXX XXX" .... is that correct? or is it XXX-XXX, or something else, or either way? Please let me know. Thanks 🙂
 
[A-Za-z][0-9][A-Za-z] [0-9][A-Za-z][0-9] <-- ok, so that should work then.

where X is any letter, and Y is any number: XYX YXY <-- correct?

Is there ever a dash in the middle, or only aways a space?
 
Well, if you want the regular expression to be a little more precise, postal codes only start with 13 different letters. Each province starts with a certain letter (BC starts with V). I am not totally sure how the territories do it.
 


<< [0-9A-Za-z][0-9A-Za-z][0-9A-Za-z] [0-9A-Za-z][0-9A-Za-z][0-9A-Za-z] >>

wow you sure like making things complicated
 
Cmin7 - Regular expressions can sometimes loog ugly on the surface, but they are really beautiful in execution 🙂 (did that make any sense?)
 
Mine was K2B-7T2, so I guess letter number letter-number letter number is correct.
<--hasn't lived in Canada for years!
 


<< [A-Za-z][0-9][A-Za-z] [0-9][A-Za-z][0-9] <-- ok, so that should work then. >>



Mmmm.. regular expressions.

I'd transform all lowercase characters to uppercase first. If there isn't a space in between, I'd add a space.

Then do a check:

[A-Z][0-9][A-Z] [0-9][A-Z][0-9]
And yes, it is true that there are only a few characters used in first letter of postal codes. BC area starts with V. Ontario (I believe) starts with L, and so on.
 


<< Well, if you want the regular expression to be a little more precise, postal codes only start with 13 different letters. Each province starts with a certain letter (BC starts with V). I am not totally sure how the territories do it. >>



I'm not sure which letters start postal codes across all of canada but I do know that Ontario starts with both K (Peterborough), L (Eastern Toronto Area) and M (Downtown Toronto).

I know they start with A is some parts of Newfoundland and aparently V in some parts of BC, plus the K, L and M(adjacent letters) in Ontario, Peteborough is east of Toronto, and Newfoundland is east of BC, I'd say postal codes have some sort of East to west relations using atleast the letters from A - V.
 
Back
Top