Launching a SaaS?·Collect waitlist signups before you build — before.run
SandboxPatternsDetectDocsChangelog
Finance
#payment
#credit-card
#finance
#visa

Credit Card Number

Generic credit card number validator supporting Visa, Mastercard, American Express, and Discover card formats.

✓ Payment form validation✓ E-commerce checkout✓ Subscription billing
/
/
Safe
Test String
3 matches
(?:…)Non-capturing group— Non-capturing group — groups without capturing (no index assigned)
44— '4' — literal character
[…]{12}Character class […]— Matches any single character listed in this set — repeated exactly 12 times · {12} — exactly 12 times
(?:…)?Non-capturing group— Non-capturing group — groups without capturing (no index assigned) — repeated zero or one time (optional) · ? — zero or one time (optional)
||— | — alternation: matches expression on left OR right
[…]Character class […]— Matches any single character listed in this set
[…]Character class […]— Matches any single character listed in this set
[…]{14}Character class […]— Matches any single character listed in this set — repeated exactly 14 times · {14} — exactly 14 times
||— | — alternation: matches expression on left OR right
66— '6' — literal character
(?:…)Non-capturing group— Non-capturing group — groups without capturing (no index assigned)
[…]{12}Character class […]— Matches any single character listed in this set — repeated exactly 12 times · {12} — exactly 12 times
||— | — alternation: matches expression on left OR right
33— '3' — literal character
[…]Character class […]— Matches any single character listed in this set
[…]{13}Character class […]— Matches any single character listed in this set — repeated exactly 13 times · {13} — exactly 13 times
||— | — alternation: matches expression on left OR right
33— '3' — literal character
(?:…)Non-capturing group— Non-capturing group — groups without capturing (no index assigned)
[…]{11}Character class […]— Matches any single character listed in this set — repeated exactly 11 times · {11} — exactly 11 times
||— | — alternation: matches expression on left OR right
(?:…)Non-capturing group— Non-capturing group — groups without capturing (no index assigned)
\d{11}digit— \d — digit (0–9) — repeated exactly 11 times · {11} — exactly 11 times
Pattern: 150 charsInput: 49 chars
100% client-side · private

✓ Valid Examples

  • 4111111111111111
  • 5500005555555559
  • 371449635398431

✗ Invalid Examples

  • 1234567890123456
  • 411111111111
  • 0000000000000000

Usage & Integration

Validate Credit Card Number natively in your backend or frontend without copying regex strings.

Node / Edge

import { validate } from '@regexto/validators';

validate('credit-card', '...');

Python

from regexto_validators import validate

validate("credit-card", "...")

Go

import "github.com/regex-to/validators-go"

valid, err := validators.Validate("credit-card", "...")

PHP

use RegexTo\Validators\Validator;

Validator::validate('credit-card', '...');

Rust

use regexto_validators::validate;

let is_valid = validate("credit-card", "...").unwrap();