Solved

validate UK postcode

Posted on 2006-07-17
4
698 Views
Last Modified: 2012-05-05
how can i validate a uk postcode. example: AB10 1LB

thanks
0
Comment
Question by:ellandrd
  • 2
4 Comments
 
LVL 23

Expert Comment

by:apresto
ID: 17122216
Hi ellandrd,

You will need to somehow get a list of all postcodes in the uk and check that the postcode exists within them - or do you mean validate the format?

Apresto
0
 
LVL 16

Author Comment

by:ellandrd
ID: 17122237
the format...
0
 
LVL 75

Assisted Solution

by:Michel Plungjan
Michel Plungjan earned 500 total points
ID: 17122302
0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 500 total points
ID: 17122370
For example

http://www.qwghlm.co.uk/blog/?cat=20&paged=2
which has a posting about using

http://www.govtalk.gov.uk/gdsc/html/frames/PostCode.htm

to get
/\b[A-PR-UWYZ][A-HK-Y0-9][A-HJKSTUW0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-HJLN-UW-Z]{2}\b/g
which seems to validate all but GIROBanks GIR NXX
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to read data from SQL server  to sharepoint 2013 ? 3 26
innerHTML 7 34
Html value of radio 14 28
asp Google Map 2 32
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question