Was this helpful?
Is Valid Zip Code
 
Rule
IsValidZipCode
Default Rule Name
<fieldname>_IsValidZipCode
Description
Checks whether a string field is a valid zip code. This metric will provide options to choose from. Default would be selected based on the locale. For example if locale is United States, then US zip code pattern would be selected.
Valid zip codes are written to the Pass Target. Invalid zip codes are written to the Fail Target.
Rule Parameters
Zip Code Format: Select from a list of countries. You can select from:
Canada
Germany
India
United Kingdom
United States
For a description of Zip Code Format options, see Remarks.
Supported Data Types
String
Remarks
Listed below are the regular Java expressions for valid zip code:
Canada: ^([A-Za-z]\\d[A-Za-z][\\s-]?\\d[A-Za-z]\\d)
Germany: ^[0-9]{5}$
India: ^[0-9]{6}$
United Kingdom: ^([Gg][Ii][Rr] 0[Aa]{2})|((([A-Za-z][0-9]{1,2})|(([A-Za-z][A-Ha-hJ-Yj-y][0-9]{1,2})|(([A-Za-z][0-9][A-Za-z])|([A-Za-z][A-Ha-hJ-Yj-y][0-9]?[A-Za-z])))) [0-9][A-Za-z]{2})$
United States: ^[0-9]{5}(-[0-9]{4})?$
Last modified date: 12/12/2024