Validating postcodes

Posted by / 28-Jul-2020 10:44

Validating postcodes

They are widely used to link individuals to various types of geographical, demographic and marketing data, and it's especially important that they are recorded and processed accurately.Unlike with US zip codes, you can't download a simple text file containing all known postcodes for use in validation routines.

However, it's relatively easy to check the syntax of a postcode.Thus, SW1A is the outward code for parts of Westminster (SW1A 2AA, for example, is the prime minister's postcode).To summarise, all valid postcodes match one of the following patterns (where A represents a letter, 9 a digit): There are a very few postcodes that don't follow the above rules, but most applications can safely ignore these.However, UK postcodes follow strict formatting rules.If you don't have access to the PAF, you can at least check that the postcodes in your application follow these rules.

validating postcodes-71validating postcodes-23validating postcodes-9

To determine whether a postcode actually exists, you would need to access the Postcode Address File.