Some real-life examples
To complete the chapter, let's see some real-life examples of validation rules you may need in your implementations:
Validate that an address postal code (that is, on Account) must be numeric, five characters long, and start with a zero:
:AND( LEN( ShippingPostalCode ) == 5, ISNUMERIC( ShippingPostalCode ), LEFT( ShippingPostalCode, 1) == "0" )
Validate the billing state for Italian addresses (aka provinces):
:AND ( BillingCountry = "ITALY", LEN(BillingState) == 2, NOT( CONTAINS("AG:AL:AN:AO:AR:AP:AT:AV:...", BillingState) ) )
A complete list of Italian provinces is available on Wikipedia at https://en.wikipedia.org/wiki/Provinces_of_Italy.
Validate the mailing country values on contact against ISO 3166 code (Wikipedia at https://en.wikipedia.org/wiki/ISO_3166-1):
:AND( LEN(BillingCountry) == 2...