You are here: Re: Need world zip codes « All PHP « IT news, forums, messages
Re: Need world zip codes

Posted by Toby Inkster on 11/29/06 23:05

nemo wrote:

> Any chance of your divulging the expression to check for the validity
> of format of UK postcodes, please?

I did post the entire source code earlier, but if you'd like an all-in-one
regexp, then you could do a lot worse than...

/([A-PR-UWYZ][A-HK-Y]?([0-9]{1,2}|[1-9][A-HJKMNPR-Y])\s+[0-9][ABDEFGHJLN
P-UW-Z]{2})|(BFPO\s+(c..?o\s+)?([0-9]{1,4}))|(GIR\s+0AA)|(SAN\s+TA1)|((
(ASCN)|(BBND)|(BIQQ)|(FIQQ)|(PCRN)|(SIQQ)|(STHL)|(TDCU)|(TKCA))\s+1ZZ)/

You'll need to remove the line breaks -- this regexp should contain no
white space. Note that this allows any amount of white space between
outgoing and incoming parts of the postcode (e.g. 'AB10 1AB' and
'AB10 1AB' both pass the test. It's a fairly trivial matter to collapse
that down if required.

This is untested, but compiled from several that I do use.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация