?

Log in

No account? Create an account
entries friends calendar profile Previous Previous Next Next
Postcodes - Ed's journal
sobrique
sobrique
Postcodes
Dear everyone who uses post codes on your website.
Would you kindly refrain from insisting my post code is incorrect if it doesn't include a space.
It's not rocket science to parse post codes.
They are
a) not case sensitive.
b) The second part is ALWAYS a digit, and two letters.
c) the 'first part' is ALWAYS two letters, and 1 or 2 digits.

(The first part is also geographically grouped, but the second part may not be.

So there's no ambiguity involved - you can't get 'mixed up' between AB1 23CD and AB12 3CD, AB123CD, ab123CD. They're all the same post code. (And it's region 'AB12').
Not being able to parse this on your website is just sloppy - at least, bearing in mind you're doing any validation whatsoever on your inputs. (Which you are, because you've spotted it hasn't got a space).
5 comments or Leave a comment
Comments
xarrion From: xarrion Date: June 13th, 2012 07:56 pm (UTC) (Link)
c) Except for central London, which is cardinal points N, S, E, W and one or two numbers. So N1 is not the same as N12
sobrique From: sobrique Date: June 13th, 2012 08:00 pm (UTC) (Link)
OK. 1-2 letters, 1-2 digits.
But the last part is still 3. So picking them out is as easy as length -3.
ehrine From: ehrine Date: June 13th, 2012 09:02 pm (UTC) (Link)
You're right that the last part is always 1 digit, 2 letters, but the first doesn't have to be 1-2 letters then 1-2 numbers. London has some freaky things like W1C 2HA. They ran out of numbers in the first bit :)
(Deleted comment)
erjholton From: erjholton Date: June 14th, 2012 03:25 am (UTC) (Link)
Considering there's even a British Standard that covers validation, and Wikipedia even gives example regexes (http://en.wikipedia.org/wiki/Postcodes_in_the_United_Kingdom#Validation), it seems a bit shoddy.
5 comments or Leave a comment