Hmmm... Regex:

> 
> This is a first stab at one...
> 
> RegEx = ^[a-zA-Z]{1,2}[1-9]{1,2}[ ]{1}[1-9]{1,2}[a-zA-Z]{1,2}&

Wouldn't work for something like

SW1P

Which is a Westminster postcode

Adding this in it is slightly more complicated (and therefore more easy to
hack), Postcodes are always upper case too:

RegEx = ^[A-Z]{1,2}[1-9][0-9A-Z]?[ ]{1}[1-9]{1,2}[A-Z]{1,2}&

Unfortunately, this also equals:

XX1X which is definitely not a postcode

Goes back to my original statement that you need to actually have a list of
postcodes to test against, which means buying the postcode database from the
Royal Mail.

The only way to really make a postcode that isn't going to be hackable is to
have all of the postcodes!  It's not a string that can be simply tested with
a regular expression (although it can be verified as a POSSIBLE postcode)

Paul




--
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to