Validating Brazilian Postcodes

Q

How to write a regular expression to validate Brazilian Postcodes?

For example, 23080-060 is a valid Brazilian Postcodes.

✍: Guest

A

Here is the regular expression to validate Brazilian Postcodes:

\d{5}-\d{3}

\d{5}       - 2 digits
-           - A -
\d{3}       - 3 digits

Click the button to test this regular expression here online:

2013-01-29, 2380👍, 0💬