BF has this neat RegEx for UK post codes on his site

http://www.forta.com/blog/index.cfm?mode=e&entry=996
[A-Z]{1,2}\d[A-Z\d]? \d[ABD-HJLNP-UW-Z]{2}

which works great (the page also describes the exact pattern permitted).

Problem is that it also permits post codes like "W3NEREF8 6TXSDF",
because within the string it can find at least one sequence specified in
the RegEx.

Any ideas how you could change the RegEx so that it also prevents the
string above from passing the validation?

I'm guessing you'd start by adding code that prohibits any other
characters before the start of it and any other characters after the end
of it, but how do you write "don't allow any of anything"?


-- 
Aidan Whitehall <mailto:[EMAIL PROTECTED]>
Macromedia ColdFusion Developer
Fairbanks Environmental Ltd  +44 (0)1695 51775
Queen's Awards Winner 2003 <http://www.fairbanks.co.uk/go/awards>

Fairbanks uses anti-spam filtering. If you sent an e-mail and expected
to receive a response but didn't, please call -- it may be that your
e-mail didn't make it to the intended mailbox.

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

--
** 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