regex pattern · ready to copy
Regex for matching IBAN (International Bank Account Number)
Match IBAN format: 2 country letters, 2 check digits, 11-30 alphanumeric. Format only, not arithmetic.
intermediate
javascript / pcre / python4 use cases
The pattern
\b[A-Z]{2}\d{2}\s?(?:[A-Z0-9]\s?){11,30}\b
Test cases
| Input | Result |
|---|---|
| DE89 3704 0044 0532 0130 00 | ✓matches |
| GB29 NWBK 6016 1331 9268 19 | ✓matches |
| FR1420041010050500013M02606 | ✓matches |
| 12345678901234 (no country prefix) | ✗rejects |
| DE89 (too short) | ✗rejects |
Edge cases & caveats
ALWAYS run mod-97 IBAN checksum verification after format match — regex format-pass ≠ valid account. Country-specific length varies (DE=22, GB=22, FR=27, etc.).
Common use cases
- EU payment form validation
- cross-border banking compliance
- audit log scraping
- fraud detection pre-check
Try variations against your data
regexlab is a free in-browser tester with side-by-side match highlighting, group inspector, and named-capture export to JS/Python/PCRE.
Open regexlab
Related
sql injection keywords · ipv4 address · username · bitcoin address · ↗ generate matching IBAN test data