On Thu, Jan 02, 2003 at 04:43:01PM +0000, Adam Rice wrote:
> David Sheldon wrote:
> > 
>m/(^|\W)(([A-Za-z][0-9]|[A-Za-z][0-9]{2}|[A-Za-z][A-HJ-Ya-hj-y][0-9]|[A-Za-z][A-HJ-Ya-hj-y][0-9]{2}|[A-Za-z][0-9][A-Za-z]|[A-Za-z][A-HJ-Ya-hj-y][0-9][A-Za-z])\s+[0-9][ABD-HJLP-UW-Zabd-hjlp-uw-z]{2}|[Gg][iI][Rr]\W+0[aA]{2})(\W|$)/
> 
> I think it's worth mentioning that, right or wrong, postcodes are often 
> written without the space in the middle. Abigail didn't mention whether 
> he wanted to just match the canonical form, or match any common form.


I'll probably make it so that people can do things like:

    use Regexp::Common;
    /$RE{zip}{British}/;                 # Uses ' ' as separator.
    /$RE{zip}{British}{-sep => '\s*'}/;  # Uses \s* as separator.
    /(?i)$RE{zip}{British}/;             # Case insensitive match.


Abigail

Reply via email to