Back to all patterns
ISO 3166-1 alpha-2 Country Code
Validation
Matches a 2-letter uppercase ISO country code (US, GB, IN, ...).
/^[A-Z]{2}$/How it works
ISO 3166-1 alpha-2 codes are exactly 2 uppercase ASCII letters. This pattern checks shape only, for membership in the actual code list, use a lookup table.
Test Cases
Should Match
- US
- GB
- IN
- DE
- ZZ
Should NOT Match
- us
- USA
- U1
Quick Summary
Matches the shape of an ISO 3166-1 alpha-2 country code (2 uppercase letters).