[Globalize] Enhancement - zip code regexes for each country

Was just playing around with trying to sort out validation of
zip/postcodes
depending on what country the user lived in, and was wondering if anyone
has
done this in a nice way? Seems to me that it would be a relatively
simple
addition to Globalize to add a regex for zip code validation to the
things
already in there?

Or am I missing a trick?
Thanks
geoff

Depends on what you want.

For example Dutch postal code must adhere to the regular expression
/^\d\d\d\d [A-Z][A-Z]$/, but it is common to accept “1000aa” (no space,
lowercase). While the latter is not valid, it can be trivially
transformed into a valid postal code.

This is not the case for the insane English postal code regular
expression:
/^([A-PR-UWYZ]\d\d?\d[ABD-HJLNP-UW-Z]{2}|[A-PR-UWYZ][A-HK-Y]\d\d?\d[ABD-HJLNP-UW-Z]{2}|[A-PR-UWYZ]\d[A-HJKSTUW]\d[ABD-HJLNP-UW-Z]{2}|[A-PR-UWYZ][A-HK-Y]\d[A-HJKRSTUW]\d[ABD-HJLNP-UW-Z]{2}|GIR0AA)$/

You can find more on Wikipedia:

Postcodereeksen - Wikipedia (Dutch)

Regards,
Erik.

Geoff H. schreef: