Validating postal code
This is so that if the user enters invalid characters, we still parse/format the space correctly.
Naturally, we also use a display picture clause to render with the space: Because we know that the input data is in upper case, it makes our validation logic cleaner, as it needs only be concerned with the upper case variations.
The info in the 2nd link was from 2007, and I think one of the articles I read was actually from the USPS site (I didn't save every link).
I'm surprised nobody has suggested making Canadian post code regexes case insensitive.
Without validating the ZIP code™, this simple typo would have gone unchecked, potentially resulting in wrongly addressed mail.
After ZIP Code™ validation: Having the correct ZIP 4™ can eliminate address correction charges and help companies qualify for special mailing rates.
There is a world of difference between: “Invalid postal code” and “Second, fourth and sixth postal characters must be numeric” For the person who typed in a letter “O” instead of a “0” (zero), this will be the clue they need to correct their error.
Lack of accurate address validation software can result in high address correction charges, failed deliveries and unhappy customers!
I thought people would be working on little code projects together, but I don't see them, so here's an easy one: Code that validates a valid US Zip Code.