Solved

validate UK postcode

Posted on 2006-07-17
4
697 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

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
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…

773 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