Skip to content

Add postcode patterns for IE (Ireland), AL (Albania), GI (Gibraltar) and IL (Israel) - #1629

Merged
nodivbyzero merged 5 commits into
go-playground:masterfrom
JohannesHepp:feat/ie-al-gi-postcodes
Oct 21, 2026
Merged

nodivbyzero merged 5 commits into
go-playground:masterfrom
JohannesHepp:feat/ie-al-gi-postcodes

Conversation

@JohannesHepp

@JohannesHepp JohannesHepp commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

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.

  • IE: ^[A-Z]\d[A-Z0-9][ ]?[A-Z0-9]{4}$ (Eircode)
  • AL: ^\d{4}$
  • GI: ^GI\d{1,2}[ ]?\d[A-Z]{2}$ (UK format)
  • IL: ^\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.

  • Tests exist or have been written that cover this particular change.

@go-playground/validator-maintainers

@JohannesHepp
JohannesHepp requested a review from a team as a code owner September 10, 2026 04:24
@JohannesHepp JohannesHepp changed the title feat(postcodes): add postcode patterns for IE, AL, GI Add postcode patterns for IE (Ireland), AL (Albania), GI (Gibraltar) Sep 10, 2026
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.
@JohannesHepp JohannesHepp changed the title Add postcode patterns for IE (Ireland), AL (Albania), GI (Gibraltar) Add postcode patterns for IE (Ireland), AL (Albania), GI (Gibraltar) and IL (Israel) Sep 21, 2026
@JohannesHepp

Copy link
Copy Markdown
Contributor Author

Hi! Friendly nudge — is there anything I can update on this PR? All checks are passing and it's in sync with master. Happy to address any feedback, or split the IL change (accepting legacy 5-digit alongside 7-digit) into a separate PR if that's easier to review.

@coveralls

coveralls commented Oct 15, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 72.569%. remained the same — JohannesHepp:feat/ie-al-gi-postcodes into go-playground:master

Comment thread postcode_regexes.go Outdated
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
nodivbyzero merged commit a5843c6 into go-playground:master Oct 21, 2026
8 checks passed
@JohannesHepp
JohannesHepp deleted the feat/ie-al-gi-postcodes branch October 22, 2026 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants