Example: US postal codes

Data in a particular field might have several valid formats. A United States postal code, for example, might be either five digits or five digits followed a hyphen (dash) and another four digits (12345-1234). If you are validating US postal codes, allow for both conditions.

The following rule validates a field that can be five digits, five digits + dash + 4 digits, or blank.

Validation of a field for US postal codes

Currently, the compiled validation ruleset does not support multiple conditions. Use the compiled validation ruleset only when your validation needs are basic. Do not fall into the trap of making complex validations more general to satisfy multiple conditions. For instance, for US postal codes, you might specify a single condition that says the value is 0 - 10 characters and at least 90% numeric. All valid US postal codes will pass this rule, but so will a lot of other values that are not in a valid format.