Validation icon indicating copy to clipboard operation
Validation copied to clipboard

Serbian Postal Codes Use 6 Digit Regex Validation when should use 5

Open DanielAlt opened this issue 5 years ago • 4 comments

Hey, Me again, your postal code friend.

My Serbians are reporting issues with our Postal Code Validator. According to them, (and this wiki https://en.wikipedia.org/wiki/Postal_codes_in_Serbia), their postal code should consist of 5 Digits. We validate against 6.

PR incoming.

DanielAlt avatar Jul 03 '20 15:07 DanielAlt

PR submitted to earliest stable release 0.9. https://github.com/Respect/Validation/pull/1305

DanielAlt avatar Jul 03 '20 16:07 DanielAlt

As the Wikipedia article states:

A six-digit postcode format has been in place since 1 January 2005

Since no transition period was defined and the 5-digit format is still rather common, the 6-digit format is not "invalid" and validation should pass both formats.

I suggest you replace the Regex by "/^(\d{5,6})$/" to cover both occurences.

omega3000 avatar Aug 27 '21 15:08 omega3000

This has been fixed on branch 2.3. It will be available on the next release.

alganet avatar Feb 19 '23 02:02 alganet

Excellent, thanks a lot!

omega3000 avatar Feb 22 '23 11:02 omega3000

Version 2.3 is available! If that doesn't work as expected, let us know! Thank you for reporting! 🐼

henriquemoody avatar Mar 09 '24 00:03 henriquemoody