Skip to content

Commit b9f1d79

Browse files
authored
feat: add postcode patterns for Colombia (CO) and British Virgin Islands (VG) (#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`
1 parent 7fa9599 commit b9f1d79

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

postcode_regexes.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ var postCodePatternDict = map[string]string{
5050
"KH": `^\d{5}$`,
5151
"CV": `^\d{4}$`,
5252
"CL": `^\d{7}$`,
53+
"CO": `^\d{6}$`,
5354
"CR": `^\d{4,5}|\d{3}-\d{4}$`,
5455
"HR": `^\d{5}$`,
5556
"CY": `^\d{4}$`,
@@ -149,6 +150,7 @@ var postCodePatternDict = map[string]string{
149150
"MQ": `^9[78]2\d{2}$`,
150151
"NC": `^988\d{2}$`,
151152
"NE": `^\d{4}$`,
153+
"VG": `^VG\d{4}$`,
152154
"VI": `^008(([0-4]\d)|(5[01]))([ \-]\d{4})?$`,
153155
"VN": `^[0-9]{1,6}$`,
154156
"PF": `^987\d{2}$`,

0 commit comments

Comments
 (0)