upu-postcode
Version:
All postcode formats, validations, and masking
969 lines • 18.1 kB
JSON
{
"id": "postcode",
"definitions": {
"AF": {
"type": "string",
"pattern": "^([1-3][0-9]|4[0-3])[0-9]{2}$"
},
"AX": {
"type": "string",
"pattern": "^(AX-)?[0-9]{5}$"
},
"AL": {
"type": "string",
"pattern": "^[0-9]{4}$"
},
"DZ": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"AS": {
"type": "string",
"pattern": "^96799(-[0-9]{4})?$"
},
"AD": {
"type": "string",
"pattern": "^AD[0-9]{3}$"
},
"AO": {
"type": "string",
"pattern": "^$"
},
"AI": {
"type": "string",
"pattern": "^AI-2640$"
},
"AG": {
"type": "string",
"pattern": "^$"
},
"AR": {
"type": "string",
"pattern": "^[CBKHUXWEPYLFMNQRAJDZSGVT][0-9]{4}[A-Z]{3}|[0-9]{4}$"
},
"AM": {
"type": "string",
"pattern": "^[0-9]{4}$"
},
"AW": {
"type": "string",
"pattern": "^$"
},
"AU": {
"type": "string",
"pattern": "^[0-9]{4}$"
},
"AT": {
"type": "string",
"pattern": "^[0-9]{4}$"
},
"AZ": {
"type": "string",
"pattern": "^AZ[0-9]{4}$"
},
"BS": {
"type": "string",
"pattern": "^$"
},
"BH": {
"type": "string",
"pattern": "^10[1-9]|1[1-9][0-9]|[2-9][0-9]{2}|1[0-1][0-9]{2}|120[0-6]$"
},
"BD": {
"type": "string",
"pattern": "^[0-9]{4}$"
},
"BB": {
"type": "string",
"pattern": "^BB11000$"
},
"BY": {
"type": "string",
"pattern": "^[0-9]{6}$"
},
"BE": {
"type": "string",
"pattern": "^[0-9]{4}$"
},
"BZ": {
"type": "string",
"pattern": "^$"
},
"BJ": {
"type": "string",
"pattern": "^$"
},
"BM": {
"type": "string",
"pattern": "^[A-Z]{2} ([0-9]{2}|[A-Z]{2})$"
},
"BT": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"BO": {
"type": "string",
"pattern": "^$"
},
"BQ": {
"type": "string",
"pattern": "^$"
},
"BA": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"BW": {
"type": "string",
"pattern": "^$"
},
"BR": {
"type": "string",
"pattern": "^[0-9]{5}-[0-9]{3}$"
},
"AQ": {
"type": "string",
"pattern": "^BIQQ 1ZZ$"
},
"IO": {
"type": "string",
"pattern": "^BBND 1ZZ$"
},
"VG": {
"type": "string",
"pattern": "^VG11([1-5][0-9]|60)$"
},
"BN": {
"type": "string",
"pattern": "^[A-Z]{2}[0-9]{4}$"
},
"BG": {
"type": "string",
"pattern": "^[0-9]{4}$"
},
"BF": {
"type": "string",
"pattern": "^$"
},
"BI": {
"type": "string",
"pattern": "^$"
},
"KH": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"CM": {
"type": "string",
"pattern": "^$"
},
"CA": {
"type": "string",
"pattern": "^[A-CEGHJ-NPR-TV-Z][0-9][A-CEGHJ-NPR-TV-Z] [0-9][A-CEGHJ-NPR-TV-Z][0-9]$"
},
"CV": {
"type": "string",
"pattern": "^[0-9]{4}$"
},
"KY": {
"type": "string",
"pattern": "^KY[0-9]-[0-9]{4}$"
},
"CF": {
"type": "string",
"pattern": "^$"
},
"TD": {
"type": "string",
"pattern": "^$"
},
"CL": {
"type": "string",
"pattern": "^[0-9]{3}-?[0-9]{4}$"
},
"CX": {
"type": "string",
"pattern": "^[0-9]{4}$"
},
"CC": {
"type": "string",
"pattern": "^[0-9]{4}$"
},
"CO": {
"type": "string",
"pattern": "^32[0-9]{4}$"
},
"KM": {
"type": "string",
"pattern": "^$"
},
"CG": {
"type": "string",
"pattern": "^$"
},
"CD": {
"type": "string",
"pattern": "^$"
},
"CK": {
"type": "string",
"pattern": "^$"
},
"CR": {
"type": "string",
"pattern": "^[0-9]{5}(-[0-9]{4})?$"
},
"CI": {
"type": "string",
"pattern": "^$"
},
"HR": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"CU": {
"type": "string",
"pattern": "^(CP)?[0-9]{5}$"
},
"CW": {
"type": "string",
"pattern": "^$"
},
"CY": {
"type": "string",
"pattern": "^[0-9]{4}$"
},
"CZ": {
"type": "string",
"pattern": "^[0-9]{3} [0-9]{2}$"
},
"DK": {
"type": "string",
"pattern": "^DK-[0-9]{4}$"
},
"DJ": {
"type": "string",
"pattern": "^$"
},
"DM": {
"type": "string",
"pattern": "^$"
},
"DO": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"TL": {
"type": "string",
"pattern": "^$"
},
"EC": {
"type": "string",
"pattern": "^[0-9]{6}$"
},
"SV": {
"type": "string",
"pattern": "^[0-9]{4}$"
},
"EG": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"GQ": {
"type": "string",
"pattern": "^$"
},
"ER": {
"type": "string",
"pattern": "^$"
},
"EE": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"ET": {
"type": "string",
"pattern": "^[0-9]{4}$"
},
"FK": {
"type": "string",
"pattern": "^FIQQ 1ZZ$"
},
"FO": {
"type": "string",
"pattern": "^[0-9]{3}$"
},
"FJ": {
"type": "string",
"pattern": "^$"
},
"FI": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"FR": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"GF": {
"type": "string",
"pattern": "^973([0-8][0-9]|90)$"
},
"PF": {
"type": "string",
"pattern": "^987([0-8][0-9]|90)$"
},
"TF": {
"type": "string",
"pattern": "^$"
},
"GA": {
"type": "string",
"pattern": "^$"
},
"GM": {
"type": "string",
"pattern": "^$"
},
"GE": {
"type": "string",
"pattern": "^[0-9]{4}$"
},
"DE": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"GH": {
"type": "string",
"pattern": "^$"
},
"GI": {
"type": "string",
"pattern": "^GX11 1AA$"
},
"GR": {
"type": "string",
"pattern": "^[0-9]{3} [0-9]{2}$"
},
"GL": {
"type": "string",
"pattern": "^[0-9]{4}$"
},
"GD": {
"type": "string",
"pattern": "^$"
},
"GP": {
"type": "string",
"pattern": "^971([0-8][0-9]|90)$"
},
"GU": {
"type": "string",
"pattern": "^969([1-2][0-9]|3[0-2])(-[0-9]{4})?$"
},
"GT": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"GG": {
"type": "string",
"pattern": "^GY[0-9]( |[0-9] )[0-9][A-Z]{2}$"
},
"GN": {
"type": "string",
"pattern": "^[0-9]{3}$"
},
"GW": {
"type": "string",
"pattern": "^[0-9]{4}$"
},
"GY": {
"type": "string",
"pattern": "^$"
},
"HM": {
"type": "string",
"pattern": "^[0-9]{4}$"
},
"HN": {
"type": "string",
"pattern": "^HN[0-9]{5}$"
},
"HK": {
"type": "string",
"pattern": "^(999077|00000)$"
},
"HU": {
"type": "string",
"pattern": "^[0-9]{4}$"
},
"IS": {
"type": "string",
"pattern": "^[0-9]{3}$"
},
"IN": {
"type": "string",
"pattern": "^[0-9]{3} [0-9]{3}$"
},
"ID": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"IR": {
"type": "string",
"pattern": "^[0-9]{10}$"
},
"IQ": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"IE": {
"type": "string",
"pattern": "^[A-Z][0-9]([0-9]|W) [A-Z]([0-9][A-Z][0-9]|[A-Z][0-9]{2}|[0-9][A-Z]{2})$"
},
"IM": {
"type": "string",
"pattern": "^IM[0-9]( |[0-9] )[0-9][A-Z]{2}$"
},
"IL": {
"type": "string",
"pattern": "^[0-9]{7}$"
},
"IT": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"JM": {
"type": "string",
"pattern": "^[0-9]{2}$"
},
"JP": {
"type": "string",
"pattern": "^[0-9]{3}-[0-9]{4}$"
},
"JE": {
"type": "string",
"pattern": "^JE[0-9]( |[0-9] )[0-9][A-Z]{2}$"
},
"JO": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"KZ": {
"type": "string",
"pattern": "^[0-9]{6}$"
},
"KE": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"KI": {
"type": "string",
"pattern": "^$"
},
"KP": {
"type": "string",
"pattern": "^$"
},
"KR": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"XK": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"KW": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"KG": {
"type": "string",
"pattern": "^[0-9]{6}$"
},
"LA": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"LV": {
"type": "string",
"pattern": "^LV-[0-9]{4}$"
},
"LB": {
"type": "string",
"pattern": "^[0-9]{4} [0-9]{4}$"
},
"LS": {
"type": "string",
"pattern": "^[0-9]{3}$"
},
"LR": {
"type": "string",
"pattern": "^[0-9]{4}$"
},
"LY": {
"type": "string",
"pattern": "^$"
},
"LI": {
"type": "string",
"pattern": "^94(8[5-9]|9[0-8])$"
},
"LT": {
"type": "string",
"pattern": "^LT-[0-9]{5}$"
},
"LU": {
"type": "string",
"pattern": "^[0-9]{4}$"
},
"MO": {
"type": "string",
"pattern": "^$"
},
"MK": {
"type": "string",
"pattern": "^[0-9]{4}$"
},
"MG": {
"type": "string",
"pattern": "^[0-9]{3}$"
},
"MW": {
"type": "string",
"pattern": "^$"
},
"MY": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"MV": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"MT": {
"type": "string",
"pattern": "^[A-Z]{3} [0-9]{4}$"
},
"MH": {
"type": "string",
"pattern": "^969(6[0-9]|70)(-[0-9]{4})?$"
},
"MR": {
"type": "string",
"pattern": "^$"
},
"MU": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"MQ": {
"type": "string",
"pattern": "^972([0-8][0-9]|90)$"
},
"YT": {
"type": "string",
"pattern": "^976([0-8][0-9]|90)$"
},
"MX": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"FM": {
"type": "string",
"pattern": "^9694[1-4](-[0-9]{4})?$"
},
"MD": {
"type": "string",
"pattern": "^MD-[0-9]{4}$"
},
"MC": {
"type": "string",
"pattern": "^980[0-9][0-9]$"
},
"MN": {
"type": "string",
"pattern": "^[0-9]{6}$"
},
"ME": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"MS": {
"type": "string",
"pattern": "^MSR 1110-1350$"
},
"MA": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"MZ": {
"type": "string",
"pattern": "^[0-9]{4}$"
},
"MM": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"NA": {
"type": "string",
"pattern": "^$"
},
"NR": {
"type": "string",
"pattern": "^$"
},
"NP": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"NL": {
"type": "string",
"pattern": "^[0-9]{4} [A-Z]{2}$"
},
"NC": {
"type": "string",
"pattern": "^980([0-8][0-9]|90)$"
},
"NZ": {
"type": "string",
"pattern": "^[0-9]{4}$"
},
"NI": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"NE": {
"type": "string",
"pattern": "^[0-9]{4}$"
},
"NG": {
"type": "string",
"pattern": "^[0-9]{6}$"
},
"NU": {
"type": "string",
"pattern": "^$"
},
"NF": {
"type": "string",
"pattern": "^[0-9]{4}$"
},
"MP": {
"type": "string",
"pattern": "^9695[0-2](-[0-9]{4})?$"
},
"NO": {
"type": "string",
"pattern": "^[0-9]{4}$"
},
"OM": {
"type": "string",
"pattern": "^[0-9]{3}$"
},
"PK": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"PS": {
"type": "string",
"pattern": "^[0-9]{3}$"
},
"PA": {
"type": "string",
"pattern": "^[0-9]{4}$"
},
"PG": {
"type": "string",
"pattern": "^[0-9]{3}$"
},
"PY": {
"type": "string",
"pattern": "^[0-9]{4}$"
},
"PE": {
"type": "string",
"pattern": "^(PE|[0-9])[0-9]{4}$"
},
"PH": {
"type": "string",
"pattern": "^[0-9]{4}$"
},
"PN": {
"type": "string",
"pattern": "^PCRN 1ZZ$"
},
"PL": {
"type": "string",
"pattern": "^[0-9]{2} [0-9]{3}$"
},
"PT": {
"type": "string",
"pattern": "^[0-9]{4} [0-9]{3}$"
},
"PR": {
"type": "string",
"pattern": "^00[0-9]{3}(-[0-9]{4})$"
},
"QA": {
"type": "string",
"pattern": "^$"
},
"RE": {
"type": "string",
"pattern": "^974([0-8][0-9]|90)$"
},
"RO": {
"type": "string",
"pattern": "^[0-9]{6}$"
},
"RW": {
"type": "string",
"pattern": "^$"
},
"RU": {
"type": "string",
"pattern": "^[0-9]{6}$"
},
"BL": {
"type": "string",
"pattern": "^97133$"
},
"SH": {
"type": "string",
"pattern": "^(STHL|ASCN|TDCU) 1ZZ$"
},
"KN": {
"type": "string",
"pattern": "^$"
},
"LC": {
"type": "string",
"pattern": "^LC[0-9]{2} [0-9]{3}$"
},
"MF": {
"type": "string",
"pattern": "^97150"
},
"PM": {
"type": "string",
"pattern": "^97500$"
},
"VC": {
"type": "string",
"pattern": "^VC[0-9]{4}$"
},
"SM": {
"type": "string",
"pattern": "^4789[0-9]$"
},
"ST": {
"type": "string",
"pattern": "^$"
},
"SA": {
"type": "string",
"pattern": "^[0-9]{5}(-[0-9]{4})?$"
},
"SN": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"RS": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"SC": {
"type": "string",
"pattern": "^$"
},
"SL": {
"type": "string",
"pattern": "^$"
},
"SX": {
"type": "string",
"pattern": "^$"
},
"SG": {
"type": "string",
"pattern": "^[0-9]{6}$"
},
"SK": {
"type": "string",
"pattern": "^[0-9]{3} [0-9]{2}$"
},
"SI": {
"type": "string",
"pattern": "^(SI-)?[0-9]{5}$"
},
"SB": {
"type": "string",
"pattern": "^$"
},
"SO": {
"type": "string",
"pattern": "^[A-Z]{2} [0-9]{5}$"
},
"ZA": {
"type": "string",
"pattern": "^[0-9]{4}$"
},
"GS": {
"type": "string",
"pattern": "^SIQQ 1ZZ$"
},
"ES": {
"type": "string",
"pattern": "^([0-4][0-9]|5[0-2])[0-9]{3}$"
},
"LK": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"SD": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"SR": {
"type": "string",
"pattern": "^$"
},
"SZ": {
"type": "string",
"pattern": "^[A-Z][0-9]{3}$"
},
"SE": {
"type": "string",
"pattern": "^[1-9]([0-7][0-9]|8[0-4]) [0-9]{2}$"
},
"CH": {
"type": "string",
"pattern": "^[0-9]{4}$"
},
"SJ": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"SY": {
"type": "string",
"pattern": "^$"
},
"TW": {
"type": "string",
"pattern": "^[0-9]{3}(-[0-9]{2})?$"
},
"TJ": {
"type": "string",
"pattern": "^[0-9]{6}$"
},
"TZ": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"TH": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"TG": {
"type": "string",
"pattern": "^$"
},
"TK": {
"type": "string",
"pattern": "^$"
},
"TO": {
"type": "string",
"pattern": "^$"
},
"TT": {
"type": "string",
"pattern": "^[0-9]{6}$"
},
"TN": {
"type": "string",
"pattern": "^[0-9]{4}$"
},
"TR": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"TM": {
"type": "string",
"pattern": "^[0-9]{6}$"
},
"TC": {
"type": "string",
"pattern": "^TKCA 1ZZ$"
},
"TV": {
"type": "string",
"pattern": "^$"
},
"UG": {
"type": "string",
"pattern": "^$"
},
"UA": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"AE": {
"type": "string",
"pattern": "^$"
},
"GB": {
"type": "string",
"pattern": "^[A-PR-UWYZ]([0-9]|[0-9]{2}|[A-HK-Y0-9][0-9]|[0-9][A-HK-Y])[ABCDEFGHJKSTUW0-9]? [0-9][ABD-HJLN-UW-Z]{2}$"
},
"US": {
"type": "string",
"pattern": "^[0-9]{5}(-[0-9]{4})?$"
},
"UY": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"VI": {
"type": "string",
"pattern": "^008(0[1-9]|[1-4][0-9]|5[0-1])?$"
},
"UZ": {
"type": "string",
"pattern": "^[0-9]{6}$"
},
"VU": {
"type": "string",
"pattern": "^$"
},
"VA": {
"type": "string",
"pattern": "^00120$"
},
"VE": {
"type": "string",
"pattern": "^[0-9]{4}(-[A-Z])?$"
},
"VN": {
"type": "string",
"pattern": "^[0-9]{6}$"
},
"WF": {
"type": "string",
"pattern": "^986([0-8][0-9]|90)$"
},
"YE": {
"type": "string",
"pattern": "^$"
},
"ZM": {
"type": "string",
"pattern": "^[0-9]{5}$"
},
"ZW": {
"type": "string",
"pattern": "^$"
}
}
}