From: Jon Reades <[EMAIL PROTECTED]>
Date: 4/1/03 10:47:55 AM

> I'm doing a little UK address validation, and after 
> looking around on CPAN didn't come up with much except 
> Reg::Common::zip, and that didn't cover UK addresses 
> (Damian, your name is on this Module, are you listening? 
> :) ). Almost everywhere else tried to sell me a service.

I believe that Abigail is maintaining this module now. Patches
are, almost certainly, welcome :)

> So far my regex looks like this (using the {} notation for
> consistency and readability):
>
> m/[A-Z]{1,2}\d{1,2}[A-Z]{0,1}\W\d{1,1}[A-Z]{2,2}/

If think I'd write that as:

m/[A-Z]{1,2}\d[\dA-Z]?\s\d[A-Z]{2}/

There are two functional changes in there.

I've replaced \d{1,2}[A-Z]{0,1} with \d[\dA-Z]? This seems to
be closer to spec, which doesn't seem to allow ANNA in the "outcode".

I've also replaced \W (any non-word character) with \s (any whitespace
character). In fact the spec specifically says that it should
be a space, so maybe you should use ' '.

My other changes (which don't effect the way the regex works)
were:

\d{1,1} -> \d
[A-Z]{2,2} -> [A-Z]{2}

hth,

Dave...

-- 
<http://www.dave.org.uk>

"Let me see you make decisions, without your television"
   - Depeche Mode (Stripped)





Reply via email to