validate UK postcode

how can i validate a uk postcode. example: AB10 1LB

thanks
LVL 16
ellandrdAsked:
Who is Participating?
 
Michel PlungjanIT ExpertCommented:
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
 
aprestoCommented:
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
 
ellandrdAuthor Commented:
the format...
0
 
Michel PlungjanIT ExpertCommented:
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.