Is there a Zip code validation Regex code library?

Options
Vera O
Vera O Member
edited December 2023 in General

Hi All,

We need to check and validate the Postal codes in our database for all the countries and I see that we have these built-in format validations for these countries:

Do you know if there is a library in Aperture for regex codes to check the Postal code format for all the countries?

Many thanks!

Kind regards,

Vera

Tagged:

Answers

  • Josh Boxer
    Josh Boxer Administrator
    Options

    Hi Vera

    You want to "check and validate the Postal codes in our database for all the countries". You have found the native Functions to check the format is correct, but have not detailed the challenge you are running into?

  • Vera O
    Options

    Hi Josh,

    we only have the mentioned format checks but not for ALL the countries. Only to CA, FR, DE, UK, US.

    So my challenge is to find a way to check for all the other countries.

    Thanks!

    Vera

  • Josh Boxer
    Josh Boxer Administrator
    Options

    OK thanks yes that makes sense. We do not use regex to check the format for other countries (most customers usually Validate the entire address at that point), but it should be possible to build out country specific format checks using regex and from some quick googling it looks like multiple countries would be the same which makes things easier (though not certain this is up to date): https://stackoverflow.com/questions/578406/what-is-the-ultimate-postal-code-and-zip-regex

  • Vera O
    Options

    Hi Josh,

    okay, yes I also googled it but these regex codes are not working as expected, but anyway if there is nothing, I will create my own library :)

    Thanks!

    Vera

  • Josh Boxer
    Josh Boxer Administrator
    Options

    If your regex is not working then this discussion might help understand why: