Skip to content

feat: add postcode patterns for Colombia (CO) and British Virgin Islands (VG)#1547

Merged
zemzale merged 1 commit intogo-playground:masterfrom
j-ibarra:feat/add-postcode-co-vg
Mar 24, 2026
Merged

feat: add postcode patterns for Colombia (CO) and British Virgin Islands (VG)#1547
zemzale merged 1 commit intogo-playground:masterfrom
j-ibarra:feat/add-postcode-co-vg

Conversation

@j-ibarra
Copy link
Copy Markdown
Contributor

Summary

Two ISO 3166-1 alpha-2 country codes are present in iso3166_1_alpha2 (i.e., valid countries) but missing from postCodePatternDict, causing postcode_iso3166_alpha2 and postcode_iso3166_alpha2_field validators to unconditionally return false for these countries.

This PR adds the missing patterns:

Country Code Pattern Example
Colombia CO ^\d{6}$ 110111
British Virgin Islands VG ^VG\d{4}$ VG1110

References

  • Colombia postal code system (Código Postal Colombiano): 6-digit numeric format
  • BVI postal code system introduced by the BVI Postal Service: VG prefix followed by 4 digits (e.g. VG1110, VG1120)

Test plan

  • All existing tests pass (go test ./...)
  • Both patterns follow the same conventions as surrounding entries in postcode_regexes.go

…nds (VG)

- CO: 6-digit format used by Código Postal Colombiano (^\d{6}$)
- VG: BVI postcode format introduced by the BVI Postal Service (^VG\d{4}$)

Both country codes are present in iso3166_1_alpha2 but were missing
from postCodePatternDict, causing postcode_iso3166_alpha2 validation
to unconditionally fail for these countries.
@j-ibarra j-ibarra requested a review from a team as a code owner March 19, 2026 03:43
Copy link
Copy Markdown
Member

@zemzale zemzale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After a quick google search, seems correct.

@zemzale zemzale merged commit b9f1d79 into go-playground:master Mar 24, 2026
7 checks passed
bfabio pushed a commit to bfabio/validator that referenced this pull request Apr 8, 2026
…nds (VG) (go-playground#1547)

## Summary

Two ISO 3166-1 alpha-2 country codes are present in `iso3166_1_alpha2`
(i.e., valid countries) but missing from `postCodePatternDict`, causing
`postcode_iso3166_alpha2` and `postcode_iso3166_alpha2_field` validators
to unconditionally return `false` for these countries.

This PR adds the missing patterns:

| Country | Code | Pattern | Example |
|---------|------|---------|---------|
| Colombia | `CO` | `^\d{6}$` | `110111` |
| British Virgin Islands | `VG` | `^VG\d{4}$` | `VG1110` |

### References
- Colombia postal code system (Código Postal Colombiano): 6-digit
numeric format
- BVI postal code system introduced by the BVI Postal Service: `VG`
prefix followed by 4 digits (e.g. `VG1110`, `VG1120`)

## Test plan

- All existing tests pass (`go test ./...`)
- Both patterns follow the same conventions as surrounding entries in
`postcode_regexes.go`
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.

2 participants