Repository navigation
Add postcode patterns for IE (Ireland), AL (Albania), GI (Gibraltar) and IL (Israel) - #1629
Merged
nodivbyzero merged 5 commits intoOct 21, 2026
Merged
Conversation
The legacy IL pattern only matched 5-digit postcodes, rejecting the 7-digit mikud format (in use since 2009). Accept both 5- and 7-digit forms; 6-digit remains invalid.
…tcodes # Conflicts: # postcode_regexes.go # validator_test.go
Contributor
Author
|
Hi! Friendly nudge — is there anything I can update on this PR? All checks are passing and it's in sync with |
nodivbyzero
reviewed
Oct 16, 2026
Equivalent to ^\d{5}$|^\d{7}$, matching the optional-group style used
elsewhere in postCodePatternDict (e.g. TW, US). Suggested in review.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
nodivbyzero
approved these changes
Oct 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
postCodePatternDict had no entry for IE, AL or GI, so postcode_iso3166_alpha2 / postcode_iso3166_alpha2_field rejected valid postcodes for those countries (the built-in fails closed on unknown countries). Adds the three patterns plus test coverage in both postcode test tables. Also extends the existing IL (Israel) pattern to accept the legacy 5-digit format alongside the 7-digit mikud.
^[A-Z]\d[A-Z0-9][ ]?[A-Z0-9]{4}$(Eircode)^\d{4}$^GI\d{1,2}[ ]?\d[A-Z]{2}$(UK format)^\d{5}(\d{2})?$(was^\d{7}$only; now accepts the 7-digit mikud as well as the legacy 5-digit — 6-digit remains invalid)Note on IL (re: #1644)
Upstream #1644 changed IL to
^\d{7}$only, dropping the 5-digit format. This PR intentionally keeps^\d{5}(\d{2})?$. Per Israel Post (see Wikipedia), the 7-digit mikud became the official format on 2013-02-01 and the 5-digit codes were only valid until 31 Jan 2013 — but they "continue to be widely used" in practice today. Accepting both avoids rejecting still-in-use 5-digit addresses; 6-digit remains invalid. Happy to switch to 7-only to match #1644 if maintainers prefer.@go-playground/validator-maintainers