Regex Library
Regex Library

19 patterns

Finance & Payments Regex Patterns

Financial data validation requires precision. These patterns validate common payment and financial identifiers including credit card numbers (Visa, Mastercard, Amex), IBAN codes, and cryptocurrency addresses.

Common Use Cases

Payment form validationIBAN verificationInvoice parsingCrypto wallet validation

All Finance & Payments Patterns

Price with Currency Symbol

Matches prices with optional currency symbols ($, €, £).

^(?:[\$\€\£]\s?)?\d+(?:[.,]\d{2})?(?:\s?[\$\€\£])?$

ISO 4217 Currency Code

3-letter currency code (EUR, USD, GBP...).

^[A-Z]{3}$

Visa Card Number

Specific validation for Visa cards starting with 4.

^4[0-9]{12}(?:[0-9]{3})?$

Mastercard Number

Specific validation for Mastercard (starts with 51-55 or 2221-2720).

^(?:5[1-5][0-9]{2}|222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}$

American Express Card Number

Validates American Express card numbers (starts with 34 or 37).

^3[47][0-9]{13}$

Bitcoin Address

Validates Bitcoin wallet addresses (Legacy, SegWit, Bech32).

^(bc1|[13])[a-zA-HJ-NP-Z0-9]{25,90}$

Ethereum Address

Validates Ethereum wallet addresses.

^0x[a-fA-F0-9]{40}$

Credit Card Number

Validates Visa, Mastercard, Amex, and Discover card numbers.

^(?:4[0-9]{12}(?:[0-9]{3})?|[25][1-7][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11})$

SWIFT / BIC Code

Validates SWIFT/BIC bank identifier codes (8 or 11 characters). Used for international wire transfers.

^[A-Z]{6}[A-Z0-9]{2}([A-Z0-9]{3})?$

IBAN — Generic International

Validates the structural format of any IBAN (2-letter country + 2 check digits + BBAN). Combine with mod-97 check for full validation.

^[A-Z]{2}\d{2}[A-Z0-9]{11,30}$

EU VAT Number

Validates the structural format of an EU VAT identifier (TVA intracommunautaire). Country prefix + 2–12 VAT-specific chars.

^(AT|BE|BG|CY|CZ|DE|DK|EE|EL|ES|FI|FR|HR|HU|IE|IT|LT|LU|LV|MT|NL|PL|PT|RO|SE|SI|SK|XI)[0-9A-Z+*]{2,12}$

Solana Wallet Address

Matches a Solana base58 address (32–44 characters, no 0/O/I/l).

^[1-9A-HJ-NP-Za-km-z]{32,44}$

ISO Currency Amount

Matches an amount with an ISO 4217 currency code prefix (e.g. USD 19.99).

^[A-Z]{3}\s\d+(?:\.\d{2})?$

German IBAN

Validates German IBAN (DE + 2 check digits + 18 BBAN digits = 22 chars).

^DE\d{20}$

UK IBAN

Validates British IBAN (GB + 2 check digits + 4-letter bank code + 14-digit account).

^GB\d{2}[A-Z]{4}\d{14}$

Spanish IBAN

Validates Spanish IBAN (ES + 22 digits = 24 chars total).

^ES\d{22}$

Italian IBAN

Validates Italian IBAN (IT + 2 check digits + 1 CIN letter + 22 digits = 27 chars).

^IT\d{2}[A-Z]\d{22}$

ISIN (International Securities ID)

Validates the ISO 6166 ISIN format: 2-letter country + 9 alphanumeric + 1 check digit.

^[A-Z]{2}[A-Z0-9]{9}\d$

Ethereum Transaction Hash

Validates Ethereum (and EVM-compatible) transaction or block hashes.

^0x[a-fA-F0-9]{64}$

Frequently Asked Questions

Should I use regex to validate credit cards?

Regex validates format only. Always run a Luhn algorithm check server-side and use a payment processor (Stripe, etc.) for actual transactions.

What is IBAN format?

Up to 34 alphanumeric characters: 2-letter country code + 2 check digits + BBAN. Example: FR76 3000 6000 0112 3456 7890 189.

How do I validate a Bitcoin address?

Legacy addresses start with 1 or 3 and are 26–34 chars long. SegWit (bech32) addresses start with bc1 - use the Bitcoin Address pattern.

Looking for patterns in other categories?

Browse all 250 patterns