Python (re)

ISO 4217 Currency Code in PY

Validate 3-letter ISO 4217 currency codes (USD, EUR, GBP, JPY, etc.) — structural check only.

Try it in the PY tester →

Pattern

regexPY
^[A-Z]{3}$

Python (re) code

pyPython
import re

pattern = re.compile(r"^[A-Z]{3}$")
input_text = "USD"
for m in pattern.finditer(input_text):
    print(m.group(0))

Stdlib `re` module — no third-party dependency. Works on Python 3.6+.

How the pattern works

^[A-Z]{3}$ requires exactly three uppercase letters, anchored to the full string. This validates the FORMAT but not the existence of the code — pair with a lookup table to ensure it's a real ISO 4217 entry like USD, EUR, GBP.

Examples

Input

USD

Matches

  • USD

Input

JPY

Matches

  • JPY

Input

us

No match

Same pattern, other engines

← Back to ISO 4217 Currency Code overview (all engines)