PostcodeFormat
interface PostcodeFormat {
pattern?: string;
example?: string;
masks?: string[];
}How a postcode is checked and written.
The example is the US's, which writes a ZIP Code of 5 digits, or of 9 or 11 with a hyphen after the fifth.
Example
CODE
{
"pattern": "^[0-9]{5}([0-9]{4}|[0-9]{6})?$",
"example": "90210",
"masks": ["#####", "#####-####", "#####-######"]
}Properties
pattern: string
A regular expression matched against the compact postcode: upper-cased, with spaces and hyphens removed, so 94103-1234 and 941031234 are one. Absent where the postcode is not checked. Whether a postcode is the chosen state's is not in the rules: POST /v1/validate checks it.
example: string
A real postcode, as the country writes it: the one the invalid message shows.
masks: string[]
How the postcode is written: # is one letter or digit, anything else a separator. The mask with as many # as the postcode has characters is used, and a postcode no mask fits is shown as typed.