Regex for IBAN Number
Regex Pattern
^[A-Z]{2}\d{2}[A-Z0-9]{4}\d{7}(?:[A-Z0-9]?){0,16}$International Bank Account Number (IBAN) format
Quick Answer
The regex pattern for iban number is `^[A-Z]{2}\d{2}[A-Z0-9]{4}\d{7}(?:[A-Z0-9]?){0,16}$`. International Bank Account Number (IBAN) format. This works in JavaScript, Python, Ruby, PHP, Java, and most regex engines that support PCRE syntax.
Test Examples
| Input | Result |
|---|---|
| GB29NWBK60161331926819 | ✓ Matches |
| DE89370400440532013000 | ✓ Matches |
| FR7630006000011234567890189 | ✓ Matches |
| 1234567890 | ✗ No match |
| GB29 | ✗ No match |
| INVALIDIBAN12345 | ✗ No match |
Code Examples
javascript
const regex = /^[A-Z]{2}\d{2}[A-Z0-9]{4}\d{7}(?:[A-Z0-9]?){0,16}$/;
const isValid = regex.test(value);python
import re
pattern = r'^[A-Z]{2}\d{2}[A-Z0-9]{4}\d{7}(?:[A-Z0-9]?){0,16}$'
if re.match(pattern, value):
print("valid")ruby
pattern = /^[A-Z]{2}\d{2}[A-Z0-9]{4}\d{7}(?:[A-Z0-9]?){0,16}$/
if value =~ pattern
puts "valid"
endphp
if (preg_match('/^[A-Z]{2}\d{2}[A-Z0-9]{4}\d{7}(?:[A-Z0-9]?){0,16}$/', $value)) {
echo "valid";
}java
String pattern = "^[A-Z]{2}\\d{2}[A-Z0-9]{4}\\d{7}(?:[A-Z0-9]?){0,16}$";
boolean isValid = value.matches(pattern);Frequently Asked Questions
Related Regex Patterns
Visa Credit Card
Visa card — starts with 4, 13 or 16 digits total
Mastercard Credit Card
Mastercard — 16 digits starting with 51-55 or 2221-2720
American Express Card
Amex — 15 digits starting with 34 or 37
Any Credit Card
Visa, Mastercard, Amex, Discover, Diners
Discover Credit Card
Discover card — starts with 6011 or 65, 16 digits total
Diners Club Credit Card
Diners Club card — starts with 300-305, 36, or 38, 14 digits total