fix(countries/MH): make postal_code_regex +4 extension optional (#1039)#1414
Merged
Conversation
The Marshall Islands postal_code_regex required the +4 extension
('-####') to be present:
Before: ^969\d{2}(-\d{4})$
After: ^969\d{2}(?:-\d{4})?$
This was inconsistent with how the same #####-#### format is encoded
for VI (Virgin Islands) and PR (Puerto Rico), where the extension is
optional. It also blocked legitimate 5-digit MH ZIPs (96960 Majuro,
96970 Ebeye) from passing the cross-reference validator's regex check
introduced in #1398.
Two changes in one regex:
1. Added '?' after the extension group → makes it optional
2. Changed '(...)' → '(?:...)' → non-capturing group, matching the
convention used in VI/PR
Validated:
- 96960 (Majuro), 96970 (Ebeye) now match
- 96960-1234 (full +4) still matches
- Invalid codes (96960-12, 123456, 969XX) correctly rejected
Refs: #1039
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
CSC Validation ReportPR Format
Labels applied: Schema Validation (250 records)Errors (blocking):
Warnings:
Duplicate Detection
❌ 1000 error(s), 1500 warning(s) | Status: Changes required Please fix the errors above and push a new commit. Refer to our Contribution Guidelines for details. |
There was a problem hiding this comment.
Pull request overview
Updates the Marshall Islands (MH) country record so its postal_code_regex accepts both 5-digit ZIPs and optional ZIP+4 extensions, aligning validation behavior with similar territories (e.g., PR/VI) and unblocking postcode cross-reference validation.
Changes:
- Adjust MH
postal_code_regexto make the-####extension optional. - Switch the extension group to non-capturing for consistency with existing patterns.
dr5hn
added a commit
that referenced
this pull request
Apr 25, 2026
Adds the 2 main Marshall Islands ZIP codes: 96960 Majuro (capital, Majuro Atoll) 96970 Ebeye (Kwajalein Atoll) Uses US ZIP system (Compact of Free Association). Now passes the cross-reference validator after the MH regex fix in #1414 made the +4 extension optional. Refs: #1039 Builds on: #1414 Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4 tasks
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.
Summary
Fixes a latent bug in Marshall Islands'
postal_code_regexthat was discovered while preparing postcode-data PRs for #1039.Why
The MH regex required the
-####extension to be present. That blocked legitimate 5-digit ZIPs96960(Majuro) and96970(Ebeye) from passing the cross-reference validator'scode↔postal_code_regexcheck introduced in #1398. Two issues in one regex:?after the extension group → made the +4 mandatory(...)instead of non-capturing(?:...)→ inconsistent with how VI and PR encode the same#####-####shapeComparison with similar countries
#####-####^008\d{2}(?:-\d{4})?$← already correct#####-####^00[679]\d{2}(?:-\d{4})?$← already correct#####-####^969\d{2}(-\d{4})$→ now:^969\d{2}(?:-\d{4})?$Validation
96960(Majuro)96970(Ebeye)96960-123496960-12123456969XXImpact
code does not match postal_code_regexerrors)countries.jsonMH record haspostal_code_format: "#####-####", no actual postcodes use this regex yetRefs: #1039