Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

validate UK postcode

Posted on 2006-07-17
4
Medium Priority
?
707 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 2000 total points
ID: 17122302
0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
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…

971 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