Skip to main content

Regex Roulette · #32 · 2026-05-06

Match strings formatted like credit card numbers (4 groups of 4 digits)

Difficulty 2/3

How to play

Write a regex that matches all green strings and rejects all red strings. Live feedback shows which strings pass. Shorter patterns score better.

Must match

  • 1234-5678-9012-3456 — not yet evaluated
  • 0000-0000-0000-0000 — not yet evaluated
  • 9999-9999-9999-9999 — not yet evaluated

Must not match

  • 1234567890123456 — not yet evaluated
  • 1234-5678-9012 — not yet evaluated
  • 1234-5678-9012-345 — not yet evaluated
  • abcd-efgh-ijkl-mnop — not yet evaluated

Loading your progress...

Pattern body only — slashes and flags (e.g. /g, /i) aren't part of the input.

0/200 chars

Type a regex that matches all green strings and rejects all red strings · Back to hub