Talk:Postcodes in the United Kingdom

From Wikipedia, the free encyclopedia
Jump to: navigation, search
          This article is of interest to the following WikiProjects:
WikiProject United Kingdom (Rated C-class, Mid-importance)
WikiProject icon This article is within the scope of WikiProject United Kingdom, a collaborative effort to improve the coverage of the United Kingdom on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
C-Class article C  This article has been rated as C-Class on the project's quality scale.
 Mid  This article has been rated as Mid-importance on the project's importance scale.
 
WikiProject Philately (Rated C-class, Low-importance)
WikiProject icon This article is within the scope of the Philately WikiProject, a collaborative effort to improve Wikipedia's coverage of philately and stamp collecting. If you would like to participate, you can visit the project page, where you can join the project and see a list of open tasks or check out the Philately Portal.
C-Class article C  This article has been rated as C-Class on the project's quality scale.
 Low  This article has been rated as Low-importance on the project's importance scale.
 
edit·history·watch·refresh Stock post message.svg To-do list for Postcodes in the United Kingdom:
  • history section called something like "existing systems" to bring together the postal districts already in place from the 19th century.
  • history section called something like "implementation" that has the chronology of the scheme being rolled out
  • overseas postcodes might belong in a different article as they are not part of the UK

Older posts[edit]

I've put London stuff here, because I don't think either article will be very long: best to avoid stubs. We can always split later if needed.

I read once that the NW & other london numbering is alphabetical by name of sorting centre. (or old name of sorting centre). can someone confirm? -- Tarquin

Name of the sub-district, according to http://www.sigtel.com/tel_info_postcodes.html - Khendon 09:47 Oct 10, 2002 (UTC)

And here is my list of London Postal Districts (which people erroneously call postcodes in all their alphabetical glory: http://www.rhaworth.myby.co.uk/phreak/londonpd.htm. Note E98 used for The Times - slightly contradicts my note about CR9 in the main article. -- RHaworth 09:02, 2005 Jan 28 (UTC)

Non-geographic postcodes[edit]

I've added a section about these to the main article. The only ones I know of are the 3 I've listed: BS98, BS99 and WC99. I'm sure there are many others. Does anyone have a list? RenesisX 11:39, 31 October 2006 (UTC)

There's SA99 for a start, which is used solely by the DVLA. You don't have to put a street address for the DVLA, you just write "DVLA, Swansea, SA99 1XX" where 1XX changes according to the section you are writing to. Dmccormac 12:40, 12 April 2007 (UTC)

You can add BX* to that list

BN99 is non-geographic —Preceding unsigned comment added by 82.44.33.230 (talk) 15:00, August 28, 2007 (UTC)

Including Sheffield United and Sheffield Wednesday as organisations with special Post Codes is ridiculous. Many football clubs, especially those with newer stadia have postcodes that reflect the club's name. This is nothing to do with them getting high amounts of mail and needing a specifically assigned one. For example, Hull City is HU3 6HU (HU = Hull) and the corresponding Gemtec Arena (now renamed Bonus Arena) is HU3 6GA (GA= Gemtec Arena). Similarly Sunderland's postcode ends in SU, Wembley Stadium's postcode ends in WS, St James Park ends in ST, Riverside Stadium ends in RS, King Power Stadium ends in FL (It's on Filbert way and former ground was Filbert Street), Darlington's Stadium ends in DL. I found these after a quick search, I'm sure there's handfuls more, so to include football clubs is ridiculous. — Preceding unsigned comment added by 86.180.32.204 (talk) 09:18, 1 November 2011 (UTC)

The postocode for the co-operative group in Manchester, M4... is non-geographic. You can include that. — Preceding unsigned comment added by 86.181.111.7 (talk) 16:00, 10 April 2012 (UTC)

FY0 1YS (allocated to the Department of National Savings site in St Annes on Sea) could be deemed non-geographic. It is the only FY0 postcode and its co-ordinate in the OSGB Code-PointOpen file lies within the site perimeter. The site is now used by Hewlett Packard. Whether or not this code is still in use by either HP or the current National Savings and Investments, I am not certain. A google for it brings up a lot of auto-generated links. Interestingly there are some references to "Mythop Road, Blackpool FY0 1YS". That is still an NS&I site, which was closely related to the St Annes one - with an internal post van travelling between the two - but a search of the NS&I website suggests they now use FY3 9.. postcodes which are in keeping with the surrounding area. As for other non-geographic postcodes in FY, PO Box postcodes seem to lie within the normal "street coding sequence", and are co-located with their relevant sorting office in the Code-Point Open file. (This is a common situation across the country with regard to PO boxes.) Rugxulo (talk) 22:53, 5 July 2012 (UTC)

Yes, FY0 is officially non-geographic. The table at List of postcode districts in the United Kingdom is current and includes annotations for non-geographic districts. — Richardguk (talk) 00:11, 6 July 2012 (UTC)

Temporary postcodes[edit]

"are asigned to, for example, building site offices (road construction)". Does anyone know how this is done? What about BFPO and ships in harbour? Rich Farmbrough 11:42, 13 Oct 2004 (UTC)

Australian Postcodes[edit]

We need some information on Australian postcodes. — Yama 8 July 2005 11:28 (UTC)

There already is information on these on List of postal codes in Australia, and it would be a help if you could put info on that page, like what year they were introduced (1972?) I admit, though, that it would be a good idea to move this article to something like UK postcode system, and redirect post code to postal code. Quiensabe 13 Jul 2005 20:55 (UTC)

If you've got changes to make, do them all. Don't delete other people's hard work and leave the rest in the hope that someone will clean up. 59.167.6.237 13:14, 2 August 2005 (UTC)
And what contribution have you made to this page? Why is pointing out that neither the UK or Australia have a monopoly on the term post code 'vandalism'?
Quiensabe 8 Aug 2005 20:55 (UTC)
A negative contribution is worse than no contribution at all.--59.167.6.237 10:18, 19 August 2005 (UTC)

'Postcode', 'Post code' and 'Postal Code'[edit]

The article title 'Postcode' notes the alternate spacing 'Post code' used in some countries (implying they're basically the same thing). By this logic 'Post Code' should redirect to 'postcode'; however, 'Post Code' *actually* redirects to 'Postal Code'....

Although I'd ask if this should be fixed, it presents a more general question about the organisation of content between the two articles. The 'Postcode' article aims to be generic (references to postcodes in countries outside the UK), yet concentrates on the UK system too much for this. And as mentioned, there's already a generic article about it ('Postal code')

My proposal is to move non-UK content in the 'postcode' article to the generic 'Postal code' article. This still leaves the UK-specific content remaining; and the article could then be titled more appropriately ('Postcodes in the UK', or something along those lines).

Finally, 'Post code' and 'Postcode' would both redirect to 'Postal code'.

(Apologies for the lack of account, which will be sorted. Please reply here, not to my anonymous 'user'. I'm on dial-up; plus, the address given is apparently the ISP's transparent web-cache address, not mine).

I completely agree with this suggestion - or alternatively that the content be merged into the article Postal Code, and a new article be established for UK postcode (this I think would amount to the same thing but it might be clearer for people to understand the intent of the change as it happens). The existence of this page (except as a seperate UK postcode article) makes no sense as there is already the above-mentioned generic article. Since the term "postal code" better embraces the various systems that other states have (ie ZIP, etc) than the UK-specific "postcode", clearly this page should give way to the Postal Code page, or otherwise be converted into a UK-specific page. --Danward 22:54, 29 April 2006 (UTC)
Apologies for being slow - there *is* by now a seperate UK article. In which case what on earth is the postcode page for??? --Danward 22:57, 29 April 2006 (UTC)

Resemble[edit]

"The letters in the inward code, however, are restricted to the set ABDEFGHJLNPQRSTUWXYZ (so cannot be one of CIKMOV), which generally d0 not resemble digits or each other when hand-written"... I would park the (...) bit at the end or something, else if you read this sentence on the radio, it sound like the "not" is referring to the CIKMOV...

"Mail from the UK continues to be treated as international, not inland, and sufficient postage must be used.": reword or something. Lost me here.

In Taiwan one can use the 3 or 5 digit versions.

Same details on another website[edit]

I have just found this online. www.absoluteastronomy.com/reference/postcode Parts of it are word for word the same. The same for this site as well.http://postcode.brainsip.com/. pjb007 17:11, 24 February 2006 (UTC)

These are totally-legal copies of Wikipedia which is why there is a warning to contributors that "If you do not want your writing to be edited and redistributed at will, then do not submit it here"!PeterEastern (talk) 10:16, 2 December 2012 (UTC)

Regular Expressions[edit]

The "definitive" regular expression does not appear to recognize "WC1N2PL", which is a valid UK post code. — 86.136.86.62 (user, talk), 16:42, April 6, 2006

You're right, though the article does disclaim: "The above regular expression does not validate some London postcodes." I still prefer my regex (the first one ;o) — OwenBlacker 12:06, 16 June 2006 (UTC)

I have removed the forward slashes and case-insensitivity marks from the following as they relate to JavaScript and not the regular expression itself:

/^[A-Z][A-Z]?[0-9][A-Z0-9]? ?[0-9][ABDEFGHJLNPQRSTUWXYZ]{2}$/i

and have also replaced:

However, this too is not completely accurate and will match many invalid postcodes. A more complete regular expressions is:
^([A-PR-UWYZ]\d\d?\d[ABD-HJLNP-UW-Z]{2}|[A-PR-UWYZ][A-HK-Y]\d\d?\d[ABD-HJLNP-UW-Z]{2}|[A-PR-UWYZ]\d[A-HJKSTUW]\d[ABD-HJLNP-UW-Z]{2}|[A-PR-UWYZ][A-HK-Y]\d[A-HJKRSTUW]\d[ABD-HJLNP-UW-Z]{2}|GIR0AA)$
(this assumes that the space between the outward code and inward code is removed, e.g. SW50QF)
The above regular expression does not validate some London postcodes. Examples include EC1V 1AA and EC1Y 1AA. None of these expressions come close to validating whether a postcode exists, as there are many otherwise valid "holes" that have not been assigned. Such a regular expression would be almost as long as the full list of postcodes. A regular expression matching just the existing outcodes is over a thousand characters long.

with the following:

However, this too is not completely accurate and will match many invalid postcodes. Yet more complete regular expressions are:
^(GIR 0AA)|([A-PR-UWYZ]\d|[A-HK-Y](?! )(\d|(?<=\d)[A-HJKSTUW])?((?<=[A-Z]{2}\d)[\dABEHMNPRV-Y])? \d[ABD-HJLNP-UW-Z]{2})$
(which will only work if lookarounds are supported by the regular expression engine being used)
^(GIR 0AA)|([A-PR-UWYZ]((\d(\d|[A-HJKSTUW])?)|([A-HK-Y]\d(\d|[ABEHMNPRV-Y])?)) \d[ABD-HJLNP-UW-Z]{2})$
(which does not use lookarounds but as a result has to be written in a non-linear fashion to keep track of the character position being tested)

which account for character position by not using optional characters in mid-stream and therefore should support the previously unsupported postcodes. — 217.46.150.171 17:58, 15 August 2006 (UTC)

Who wrote this:

A more complex regular expression is also given in the comments of the schema, which implements full checking of all the stated BS 7666 postcode format rules. That regular expression can be restated as a "traditional" regular expression:
(GIR 0AA|[A-PR-UWYZ]([0-9]{1,2}|([A-HK-Y][0-9]|[A-HK-Y][0-9]([0-9]|[ABEHMNPRV-Y]))|[0-9][A-HJKS-UW]) [0-9][ABD-HJLNP-UW-Z]{2})

Not only do they not explain why they refer to this as a "traditional" regular expression but successive alternations of the majority of the outward pattern are far from efficient as they will result in excessive backtracking and therefore repeated testing of already known positions—and why [0-9] rather than \d in this instance? — 217.46.150.171 16:42, 27 September 2007 (UTC)

Original research on my part distils BS7666 down to the following RegExp:

([A-PR-UWYZ]([1-9]([0-9]|[A-HJKSTUW])?|[A-HK-Y][1-9]([0-9]|[ABEHMNPRVWXY])?) *[0-9][ABD-HJLNP-UW-Z]{2}|GIR *0AA)

Easier to read pseudocode for the above; L1 to L5 are the separate letter classes (no pun intended); L1 to L4 fall in their respective numbered positions, e.g. L3 can only be the third character, N1 = [1-9] and N0 = [0-9]:

L1( N1( N0 | L3 )? | L2 N1( N0 | L4 )? ) <space>* N0 L5 L5, or GIR <space>* 0AA

... In fact now I look at it, 217.46.150.171 seems to have beaten me to the punch on this. Mine only excludes the possibilty of a single zero in the first half of a postcode, which is invalid, and allows for as many spaces as necessary. I guess this means that two separate people have come up with the same RegExp, which lends credence to it. Rather than start a holy editing war on the main page, I'll leave that alone and leave this here until someone can verify it and put it on the main page. Cyrek (talk) 14:34, 7 June 2010 (UTC)

This incorrectly excludes postcodes in areas which have a valid district zero (all postcodes in districts BL0, CM0, CR0, FY0, HA0, PR0, SL0 and SS0).
Less critically, and in common with most other postcode regexes, it wrongly allows postcodes with many invalid area codes (such as the non-existent areas A, AA, Z and ZY).
See #Validation Algorithms (below) for a longer regular expression that correctly filters all valid and invalid areas.
Richardguk (talk) 16:23, 7 June 2010 (UTC)

Exceptions[edit]

I've added the postcode for Santa (SAN TA1), and there's and interesting website here: [1] that lists similar valid addresses for other countries.

Apart from Santa, can anyone say definitively if GIR 0AB is also an allowable exception in addition to GIR 0AA?

I believe there is also a 'test' postcode that is valid in the PAF, but does not correspond to anywhere real - anyone know what it is - it might possibly be the FX postcode apparently used in training. I have no idea if the AM code for Ambridge validates properly in the PAF either.

WLD 14:31, 12 July 2006 (UTC)

The Royal Mail's address finder says both GIR 0AA and SAN TA1 are not in the correct format (or "You have entered the Postcode incorrectly.", as opposed to "The address or postcode you have entered is not listed in our database."). I'm not sure what the most authorative source for postcodes is though. Elektron 14:23, 27 July 2006 (UTC)
Left hand, meet right hand. As you've discovered, determining whether a particular postcode is valid or not is tricky, and the on-line address finder is not authoritative, and neither is the PAF. There probably isn't a single authoritative source, unfortunately. GIR 0AA is definitely valid, as it is still in use by Alliance & Leicester, who took over GIRObank in the UK. WLD 20:28, 27 July 2006 (UTC)
The postcode element of the addresses side of British Standard BS7666 (Spatial datasets for geographical referencing) is covered in the appropriate page of the UK Government Data Standards Catalogue - 217.46.150.171 08:26, 16 August 2006 (UTC)
That standard validates the format, not the content. And, it also explicitly lists GIR 0AA as an exception still used. Furthermore, I don't think it claims to be definitive - that is, I think it is a descriptive standard, not a prescriptive one. I would expect the Royal Mail to have a source document describing both the format and valid contents of their implementation of a postal code - not least as a specification for the automated sorting machines - but whatever they have does not seem to be available to the general public. The PAF is not definitive, even though many organisations erroneously treat it as such. WLD 10:02, 16 August 2006 (UTC)
The standard is just that a British Standard and the postcode section is only part but does prescribe - for the time being at least - the structure of UK postcodes that are or could be assigned. It is however acknowledged that these conventions may change in the future if operationally required. - 217.46.150.171 10:45, 16 August 2006 (UTC)
I think it has been updated - see here, and I don't have access to the 2006 revised edition. The link you give says "The code allocated by the Post Office to identify a group of postal delivery points.", so the document you link to acknowledges ownership of the code by the 'Post Office' i.e. it is not defined by the standard. The British Standard can say what it likes e.g. "the colour of Smarties will be that determined by the confectioner", so so long as the confectioner chooses the colour, then he is following the standard. If someone other than the confectioner were to choose the colour of the Smarties to be manufactured, the standard would not then be being followed. The standard doesn't say what the colours will be. In this case, the standard is effectively saying that it is whatever the 'Post Office' says, then goes on to attempt to describe the practice of the 'Post Office'. WLD 11:10, 16 August 2006 (UTC)
You are right that there appears to have been a very recent update - I'll reserve further comment until I have been able to delve deeper into its nature - 217.46.150.171 14:40, 16 August 2006 (UTC)
Thanks WLD 15:55, 16 August 2006 (UTC)
Any update? Cheers. 85.158.137.195 08:56, 17 October 2007 (UTC)
The standard describes the elements that make up an address, and state that one of those elements is postcode. The description of possible formats isn't a definitive part of the standard, because the format of postcodes is a matter for Royal Mail. Mayalld 15:17, 17 October 2007 (UTC)
Royal Mail's Letters to Santa page at http://www.royalmail.com/letters-to-santa now lists XM4 5HQ as the "Santa" postcode (does it replace SAN TA1?). 06 Dec 2013 — Preceding unsigned comment added by 213.123.247.235 (talk) 16:51, 6 December 2013 (UTC)

UK Postcodes[edit]

Norwich now uses standard form postcodes: NRx yzz, (correctly stated in the detailed history) and not the original trial form NOR xxx (as claimed in the introductory section on possible formats).

What lottery?[edit]

Section #Postcode_lottery doesn't mention any lottery. --Jidanni 2007-03-12

"Postcode lottery" is a political cliche not a lottery and really shouldn't be in the article. It refers to unequal distribution of resources by geographical area. This can be eg NHS treatment or funding from the "good causes" bits of the national lottery. Secretlondon 13:06, 29 March 2007 (UTC)
I've made it a separate article. Andy Mabbett 13:17, 29 March 2007 (UTC)

Mailsort[edit]

This claims that the standard format of Postcodes "does not achieve its objective of primarily identifying the main sorting office and sub-office". But they do, mailsort customers dont have to you mailsort coedes they can use an OCR font which will provide 100% reco-rates off Royal Mail's Address Interpretation system. Mailsort codes are just an alternative if you are not using an OCR font for whatever reason. I think this part of the article is misleading, UK postcodes are to a resolution of thoroughfare or part thoroughfare. Much more accuate that some other countries (i.e. France) which have postcodes to delivery office level.

UK postcodes will resolve right down to, at most, around 50 adresses's, and as few at 15-ish. Also, with the introduction of DPC/DPS (Delivery Point Code/Delivery Point Suffix) automation sorting, automation will be able to resolve right down to individual adresses's. UK postcodes are not just SW1A 1AA, they are SW1A 1AA"A1" etc. This denotes individual adresses's within SW1A 1AA.

Croydon[edit]

The article says that CRO (oh) was allocated and then CR2, CR3. Later the article says that CR0 (zero) was not changed to CR1. Should that first CRO (oh) be a CR0 (zero)? -- SGBailey 19:36, 5 September 2007 (UTC)

The number in the outward[edit]

I heard that the number in the first part of the postcode is the approximate distance in miles from the nearest main sorting office - so NG5 xxx is approx 5 miles from the main Nottingham sorting office. Is this true, and if so can details be sourced and added into the article. Burns flipper (talk) 18:45, 10 February 2008 (UTC)

This is not true. District numbers were generally assigned in a clockwise direction outwards from the '1' district in the main town or city. Could someone word this better and add it? 137.205.74.30 (talk) 22:06, 1 October 2008 (UTC)

Norwich postcode history[edit]

The codes were in the form NOR followed by three digits. I think I'll need a {{cn}} on this. When I was applying for a place at UEA in 1975-76 the university was still using NOR 88C as its postcode on some documentation, as well as its modern code NR4 7TJ, so obviously not all codes ended in three digits. -- Arwel Parry (talk) 10:41, 21 December 2008 (UTC)

Just did a search for postal addresses/postcodes in the London Gazette, and these seem typical examples:

They all seem to be in the format NOR digit-digit-letter, although a code such as NOR 42O (four-two-oh) could be read (four-two-zero), and "I"s could similarly be misread as "1"s. Lozleader (talk) 21:58, 21 December 2008 (UTC)

Try again[edit]

Map showing Postcode areas.

This map is only about 70% correct. I have removed it from the page. 137.205.74.230 (talk) 21:27, 19 January 2009 (UTC)

I've looked at the OpenStreetMap source for this. Most of the errors are accounted for by small exclaves of postcode areas in other areas, some of which are hundreds of kilometres from their parent towns. I do not know these to exist in the real plan, which should look like http://blogs.tmb.uk.com/underthesun/uk_postcode_map.gif. If you zoom in most areas regain their correct labels, but the anomalies are still there and become more numerous. My conclusion is that until OpenStreetMap can substantially upgrade this application to avoid exclaving, this is a completely unsuitable method of generating an image for this. 137.205.74.230 (talk) 21:51, 19 January 2009 (UTC)

Validation Algorithms[edit]

I've found that the most complete regular expression for post codes doesn't match all London post codes because the post office have sneakily started allowing an alphabetic character in the fourth position (eg. EC3V 9AA) —Preceding unsigned comment added by 88.96.159.81 (talk) 07:53, 14 May 2009 (UTC)

Fixable - try http://poker.peardox.com/map.php?pc=EC3V9AA (dev server - example)

This is the PHP I use...

function is_postcode($test)

 {
 // The postcode matching regex
 $pc_regex = '/(GIR 0AA|[A-PR-UWYZ]([0-9]{1,2}|([A-HK-Y][0-9]|[A-HK-Y][0-9]
             ([0-9]|[ABEHMNPRV-Y]))|[0-9][A-HJKS-UW]) *[0-9][ABD-HJLNP-UW-Z]{2})/';
 if(preg_match($pc_regex, strtoupper($test)) == 1)
   {
   return TRUE;
   }
 return FALSE;
 }

Before you get as far as this it's a REQUIREMENT that you clean the input using this...

// Sanitize a possible postcode

function normalise_postcode($pc)

 {
 $rval = false;
 $test = strtoupper(trim($pc));
 $test = str_replace(" ","",$test);
 if((strlen($test) > 4) && (strlen($test) < 8))
   {
   $rval = substr($test, 0, strlen($test)-3) . str_repeat(' ', 7 - strlen($test)) . substr($test, -3);
   }
 return $rval;
 }

If you get a non-false from normalise_postcode you can pass it through is_postcode then further down the ladder

The reason you do it this way is that you can be assured you have something that looks like a postcode before you chuck it at a Database - thereby eliminating SQL injection (there are other reasons as well - far beyond the scope of this page though) —Preceding unsigned comment added by Peardox (talkcontribs) 18:44, 23 May 2010 (UTC)

Gonna explain this in detail on safepear sometime when I have 5 mins

— Previous unsigned comment added by User:Peardox (Talk) 17:42, 23 May 2010 (UTC)

The reason you would do that has nothing to do with SQL injection. There's a few basic principles to avoid SQL injection, which go beyond the scope of the concerns here. I would check with RoyalMail to see how they define a postcode and validate against that definition. --Hm2k (talk) 20:15, 23 May 2010 (UTC)

Regex expressions such as the one above, and others on this page and elsewhere, wrongly assume that the second letter has no correlation with the first. A more refined regx would be:

  1. $pc_regex = '/(';
    
  2. $pc_regex .= '(A[BL]|B[ABDHLNRST]?|C[ABFHMORTVW]|D[ADEGHLNTY]|E[HNX]?|F[KY]|G[LUY]?|H[ADGPRSUX]|I[GMPV]|JE|K[ATWY]|L[ADELNSU]?|M[EKL]?|N[EGNPRW]?|O[LX]|P[AEHLOR]|R[GHM]|S[AEGKLMNOPRSTY]?|T[ADFNQRSW]|UB|W[ADFNRSV]|YO|ZE)[1-9]?[0-9]|';
    
  3. $pc_regex .= '([E|N|NW|SE|SW|W]1|EC[1-4]|WC[12])[A-HJKMNPR-Y]|';
    
  4. $pc_regex .= '[SW|W]([1-9][0-9]|[2-9])|';
    
  5. $pc_regex .= 'EC[1-9][0-9]';
    
  6. $pc_regex .= ') [0-9][ABD-HJLNP-UW-Z]{2}/';
    

This covers, respectively:

  1. all areas which are valid for potentially any numeric district 0–99 (excludes EC, SW, W and WC because EC1–EC4, SW1, W1 and WC1–WC2 are only valid with a letter suffix)
  2. London alphanumeric districts (allows for any letter suffix except [ILOQZ])
  3. SW2–SW99 and W2–W99 (all-numeric districts excluding SW1 and W1 which are only valid with a letter suffix)
  4. EC10–EC99 all-numeric districts (currently only EC50 exists but allowing for future change).

The following assumptions are made:

  • that the 124 standard postcode areas covering the UK and crown dependencies do not change (very rare, last change was the addition of HS in 1995)
  • that the districts permitting or requiring a letter suffix do not change (currently limited to London Central districts; has expanded in recent years, but with all the London 1 districts now permitting a letter suffix, further change seems less likely)
  • the following simplifications to keep the expression relatively short and valid for a reasonable duration:
    • that, subject to any letter suffix requirement, any numerical district 0–99 is valid for any area (this could be refined but new districts are often created to revise boundaries or create non-geographical districts)
    • that, for districts requireing or permitting a letter suffix, and letter is valid except [ILOQZ] (the excluded characters are a de facto current standard connected with their likelihood of being mistaken for digits; suffix letters have been revised regularly in recent years)
    • that any sector 0–9 is valid for any area
    • that the last two letters can be any pair from the alphabet excluding the letters [CIKMOV] (a published requirement and impossible to refine without validating against the full postcode list).

It is trivial to add validation of GIR 0AA, but I doubt whether in practice this well-known exception would exist as a valid entry in any real-world list. Other valid codes are far more likely to be found in most large address lists, such as BFPO boxes and the new BX non-geographic area postcodes.

Richardguk (talk) 20:49, 23 May 2010 (UTC)

--Hm2k (talk) 08:03, 24 May 2010 (UTC)

Vanity list[edit]

The list of vanity postcodes is getting quite long. It only needs to be a few examples. Also, the "hierarchy" in the Westminster postcodes is unreferenced. I'm thinking of trimming this down to 5-10 examples. MRSC (talk) 07:55, 11 January 2010 (UTC)

It appears that much of the vanity list has no location info —Preceding unsigned comment added by Peardox (talkcontribs) 17:37, 23 May 2010 (UTC)

Of all the records on OS Open there are currently 6,023 records with a PQI of 90 - this means they don't have any location information on those postcodes —Preceding unsigned comment added by Peardox (talkcontribs) 17:57, 23 May 2010 (UTC)

Either supply me Peardox the vanity list or grab the stuff from safepear if you want it checked - quicker solution is just gimme the list as I already have the DB on a load of servers —Preceding undated comment added 18:38, 23 May 2010 (UTC).

Specialist Knowledge[edit]

It would be useful to not insist on citations for paragraphs that clearly stem from specialist on-the-job knowledge of the postal system. For example, on how practical systems work. I am despondent at the thought of individuals with nothing better to do than to track changes to the work, only to adorn them with a pointless need for citation. Get out there and deliver letters, or spend months coding letters. Better still, do something useful - almost anything would do in preference to this kind of idiotic contribution. Ronpedia (talk) 11:29, 30 April 2011 (UTC)

Oh dear, didn't mean to offend. Unfortunately specialist knowledge that is in one's own head fails the reliable sources guideline. We can't really use it unless we have "reliable, published sources" to back it up. Also, in my defence, you added a lot of text without using any edit summaries which always raises suspicions. I'm pretty sure someone lelse would have picked it up if I hadn't.
The para contains some information that is new to me and I assume the general reader, so it would be a useful addition to the article. There must be a published source for this: even an internal Royal Mail document or guideline, it doesn't necessarily have to be freely available to the general public.
Anyway, as a constructive way forward I suggest we cut the relevant paragraph, paste it here, find a few refs and put it back into article space. Should only take a short while.
I would point out that we try to assume good faith and have a policy of no personal attacks. Accusing someone of an "idiotic contribution" is sailing a bit close to the wind. Lozleader (talk) 14:08, 30 April 2011 (UTC)
Well, I've done it for you. It took HOURS! Next time you might add the refs yourself per WP:BURDEN: "The burden of evidence lies with the editor who adds or restores material. You may remove any material lacking a reliable source that directly supports it". Cheers. Lozleader (talk) 21:14, 9 May 2011 (UTC)

Reliable souce?[edit]

Is this: Sutton, Peter (14 January 2011). "Designing the postcode: sorting machines, psychology and Sir Gordon Radley". British Postal Museum and Archive. Retrieved 14 December 2011.  a reliable souce? Some very interesting annd solid info on the design and introduction of postcodes but it's a blog so probably not, but it is published as part of the British Postal Museum and Archive site. Lozleader (talk) 14:38, 14 December 2011 (UTC)

I can't find it published on the site of The British Postal Museum & Archive. -- Trevj (talk) 10:03, 3 May 2012 (UTC)
Hmmm. That particular blog isn't linked from their static website, but others on the postalheritage.wordpress.com are.
For instance this page "The Post Code".  links to "Publicising the postcode". . The wordpress blogs appear to be "kosher" and under the aegis of the BPM&A. Presumably back in January 2011 it was linked form the main site? Lozleader (talk) 11:28, 3 May 2012 (UTC)
OK. It seems to be an issue with who's doing the publishing. http://www.postalheritage.org.uk/page/peoplespost-postcode refers to Helen Dafter's blog. It turns out that she's an archivist with the museum (WP:OR).[2][3]. Maybe this should be brought up at WP:RSN. -- Trevj (talk) 12:12, 3 May 2012 (UTC)
Agree. Lozleader (talk) 16:03, 3 May 2012 (UTC)

British Forces Post Office[edit]

The Validation section currently states that:

NB: British Forces Post Office postcodes do not follow the BS 7666 rules, but have the format "BFPO NNNN" or "BFPO c/o NNNN", where NNNN is 1 to 4 numerical digits.

While I seem to recall previously seeing "BFPO c/o NNNN", the current Lookup BFPO Numbers has, under the section on "BFPO No - Naval Party, Location", the format "c/o BFPO NNN" instead. Unless anyone knows a more authoritative source that contradicts this, I believe an edit is in order (perhaps, subject to other sources, one allowing either form). — 81.130.7.175 (talk) 10:31, 15 March 2012 (UTC)

Cleanup[edit]

I have just completed what has turned out to be an extensive cleanup of the article. In the process I have:

  • Re-organised content into more logical sections and under clearer headings
  • Created a new history section based on existing content ordered chronologically
  • Moved content of more general interest towards the top of the article and more specialist information towards the end.
  • During this process I have avoided any significant changes to the meaning or content of the article, other than to remove some duplicated information.

--PeterEastern (talk) 10:09, 2 December 2012 (UTC)

  • I haven't checked every change but, for example, your rewrite of "Only a few areas have a district 0..." as "And these only have a district 0..." wrongly implies that some areas have no district other than district zero! Without proofreading every other change, this suggests that other drafting errors might also have crept in. Richardguk (talk) 14:00, 2 December 2012 (UTC)
  • Thanks, I will take a look at that now. PeterEastern (talk) 15:17, 2 December 2012 (UTC)
  • I have now made a number of corrections and clarifications to the best of my knowledge and also included links to the relevant articles on districts and areas.PeterEastern (talk) 15:48, 2 December 2012 (UTC)
  • The heading "Formatting" does not make sense as the parent section of the subsections relating to special types of postcode. On the other hand, the "Validation" subsection ought to be nearer to the Format[ting] section and the table of formats ("A9 9AA" etc) should be moved back into the Format section as it illustrates key terminology. Richardguk (talk) 14:00, 2 December 2012 (UTC)
  • I have moved the A9 9AA table into 'Formatting'. Personally I think the validation section it too detailed to come early in the article and would prefer it tucked away later in the article given that is appears to be written for the benefit of a computer programmers at present. PeterEastern (talk) 15:17, 2 December 2012 (UTC)
  • I have now moved the validation section next to formatting as you suggested.
  • The contemporary meaning of outward code, postcode district etc needs to be explained prominently near the beginning. More generally, "postcode district" should be used consistently in relation to modern postcodes, instead of the obsolete term "postal district" (which, in the context of London, formerly referred to what are now known as postcode areas). It needs to be clear that a few postcode districts are split between post towns, so the relationship between towns and districts is not as simple as currently described. Richardguk (talk) 14:00, 2 December 2012 (UTC)
  • OK. Possibly someone more expert in distinctions will need to help us with that one.PeterEastern (talk)
I agree that the article would benefit from cleaning up and rewriting, but I think that the above changes need detailed review. Richardguk (talk) 14:00, 2 December 2012 (UTC)
  • Happy to assist with the review. I do think the article will be much clearer when we are done. PeterEastern (talk) 15:17, 2 December 2012 (UTC)
  • Might I just add that an actual example of the use of postcodes would be helpful? I came to this page to find out where in the address the postcode is used, i.e. is it before the town name, after the town name, etc., etc. Surprised that this information is not given at all. This is a very technical article and a more general intro would be useful. The relevant introductory section on the "Postal code" entry (https://en.wikipedia.org/wiki/Postal_code#UK) also gives no examples. Surely a simple example of use could be given in the introduction or an introductory section? Nrubdarb (talk) 10:37, 12 March 2014 (UTC)

Regular expression - notable?[edit]

I can't help thinking that the following content doesn't belong in an encyclopedia. If it does then is should surely be reduced in length and sharpened up. For now I have moved it to this section where we can discuss it or improve it. Any thoughts? PeterEastern (talk) 16:18, 2 December 2012 (UTC)

--

A regular expression is given in the comments of the schema, which implements full checking of all the stated BS 7666 postcode format rules. That regular expression can be restated as a "traditional" regular expression:

(GIR 0AA|[A-PR-UWYZ]([0-9]{1,2}|([A-HK-Y][0-9]|[A-HK-Y][0-9]([0-9]|[ABEHMNPRV-Y]))|[0-9][A-HJKPS-UW]) [0-9][ABD-HJLNP-UW-Z]{2})

This can be further reduced, through removal and combination of redundant alternatives and character classes, down to:

(GIR 0AA|[A-PR-UWYZ]([0-9][0-9A-HJKPS-UW]?|[A-HK-Y][0-9][0-9ABEHMNPRV-Y]?) [0-9][ABD-HJLNP-UW-Z]{2})

NB: British Forces Post Office postcodes do not follow the BS 7666 rules, but have the format "BFPO NNNN" or "BFPO c/o NNNN", where NNNN is 1 to 4 numerical digits.

An alternative short regular expression from BS7666 Schema is:

[A-Z]{1,2}[0-9R][0-9A-Z]? [0-9][ABD-HJLNP-UW-Z]{2}

The above expressions fail to exclude many non-existent area codes (such as A, AA, Z and ZY). A more refined regex, which excludes all invalid areas and some invalid districts is:

(GIR 0AA)|(((A[BL]|B[ABDFHLNRSTX]?|C[ABFHMORTVW]|D[ADEGHLNTY]|E[HNX]?|F[KY]|G[LUY]?|H[ADGPRSUX]|I[GMPV]|JE|K[ATWY]|L[ADELNSU]?|M[EKL]?|N[EGNPRW]?|O[LX]|P[AEHLOR]|R[GHM]|S[AEGKLMNOPRSTY]?|T[ADFNQRSW]|UB|W[ADFNRSV]|YO|ZE)[1-9]?[0-9]|((E|N|NW|SE|SW|W)1|EC[1-4]|WC[12])[A-HJKMNPR-Y]|(SW|W)([2-9]|[1-9][0-9])|EC[1-9][0-9]) [0-9][ABD-HJLNP-UW-Z]{2})

The preceding expression also matches the legacy GIR 0AA and the new BF and BX non-geographic postcodes.