Validator: UpuPostalCodeAlgorithm/Attribute

Currently supports 43 countries:

AD (Andorra),AL (Albania),AM (Armenia),AR (Argentina),AT (Austria),AU (Australia),AZ (Azerbaijan),BB (Barbados),BD (Bangladesh),BE (Belgium),BM (Bermuda),BN (Brunei),CA (Canada),CH (Switzerland),CN (China),CY (Greek Cyprus),DE (Germany),DK (Denmark),DO (Dominican Republic),DZ (Algeria),ES (Spain),FI (Finland),FO (Faroe Islands),FR (France),GB (United Kingdom),GR (Greece),IS (Iceland),IT (Italy),JP (Japan),LI (Liechtenstein),LU (Luxembourg),LV (Latvia),MC (Monaco),MT (Malta),MX (Mexico),NL (Netherlands),NO (Norway),PT (Portugal),SE (Sweden),SM (San Marino),US (United States),VA (Holy See (Vatican City State)),VN (Viet Nam)

Selected examples:
  • Australia (^\d{4}$) based on data downloaded from Australia Post
  • Argentina (^[A-Z]\d{4}[A-Z]{3}$) based on Wikipedia and Correo Argentino
  • Barbados (^BB\d{5}$) based on Wikipedia
  • Bermuda (^[A-Z]{2} *(\d{2}|[A-HJ-N]X)$) based on Frank
  • Canada (^[ABCEGHJKLMNPRSTVXY]{1}\d{1}[A-Z]{1} *\d{1}[A-Z]{1}\d{1}$) based on Wikipedia
  • Dominican Republic (^\d{5}$) based on Frank
  • United Kingdom (^(GIR *0AA)|((([A-Z][0-9][0-9]?)|(([A-Z][A-HJ-Y][0-9][0-9]?)|(([A-Z][0-9][A-Z])|([A-Z][A-HJ-Y][0-9]?[A-Z])))) *[0-9][A-Z]{2})$) based on BS7666
  • United States (^\d{5}(-\d{4}){0,1}$) based on USPS

More countries will be added (probably alphabetically) over time.

Last edited Jan 12, 2010 at 1:00 AM by markscottjohnson, version 9


No comments yet.