Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

validate UK postcode

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

thanks
0
Comment
Question by:ellandrd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

664 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