Skip to main content

         This documentation site is for previous versions. Visit our new documentation site for current releases.      

Extending postal code validation to other countries

Updated on January 18, 2021

Pega Government Platform includes an edit validate rule that you can use in flow action rules to verify if the postal codes that users enter have the correct format. By default, the rule includes validation for postal codes for the United States, India, Canada, and the United Kingdom. Enable the tools that validate postal codes for more countries by extending the rule to cover other countries that you define in your application, for example, Canada.

  1. In Dev Studio, search for and select the PostalCodeFormat edit validate rule.

  2. Include strings for other countries by editing the java source. The following example demonstrates the string for Canada:

    String canZIP= "^[ABCEGHJKLMNPRSTVXY]\\d[ABCEGHJKLMNPRSTVWXYZ]( )?\\d[ABCEGHJKLMNPRSTVWXYZ]\\d$"; if(CountryCode.equals("CAN")) { p = java.util.regex.Pattern.compile(canZIP);

    m = p.matcher(theValue); isvalidZIP = m.matches(); if((isvalidZIP == false) ){ return false; } }

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best. is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us