Forum: Ruby on Rails [Globalize] Enhancement - zip code regexes for each country

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Geoff H. (Guest)
on 2006-05-12 00:06
(Received via mailing list)
Was just playing around with trying to sort out validation of
depending on what country the user lived in, and was wondering if anyone
done this in a nice way? Seems to me that it would be a relatively
addition to Globalize to add a regex for zip code validation to the
already in there?

Or am I missing a trick?
Erik van Oosten (Guest)
on 2006-05-12 09:55
(Received via mailing list)
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

You can find more on Wikipedia: (Dutch)


Geoff H. schreef:
This topic is locked and can not be replied to.