Validation
ISO 3166-1 alpha-2 Country Code
Validate 2-letter ISO 3166-1 alpha-2 country codes (US, GB, FR, JP, etc.) — structural check only.
Try it in RegexPro →Available in
Pattern
regexengine-agnostic
^[A-Z]{2}$Raw source: ^[A-Z]{2}$
How it works
^[A-Z]{2}$ requires exactly two uppercase letters anchored to the full string. Like the currency-code pattern, this verifies FORMAT not membership — combine with the official list to ensure the code actually exists.
Examples
Input
USMatches
US
Input
GBMatches
GB
Input
USANo match
—Common use cases
- •Address form validation
- •Geo-routing in CDNs and APIs
- •Compliance / GDPR jurisdiction routing
- •Localization config validation
Related patterns
ISO 4217 Currency Code
ValidationValidate 3-letter ISO 4217 currency codes (USD, EUR, GBP, JPY, etc.) — structural check only.
Canadian Postal Code
ValidationMatch Canadian postal codes in the A1A 1A1 or A1A1A1 format with valid first-letter prefixes.
IBAN (International Bank Account Number)
ValidationValidate IBAN bank account identifiers: 2-letter country code, 2 check digits, 11–30 alphanumerics.
SWIFT / BIC Code
ValidationValidate SWIFT/BIC bank identifier codes — 8 chars (head office) or 11 chars (branch).