DD
DevDash

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

InputResult
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"
end

php

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

Want API access + no ads? Pro coming soon.