Skip to main content

Regex Roulette · #20 · 2026-04-24

Match strings of alternating a and b characters

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

  • ab — not yet evaluated
  • abab — not yet evaluated
  • ababab — not yet evaluated
  • a — not yet evaluated

Must not match

  • ba — not yet evaluated
  • aa — not yet evaluated
  • abb — not yet evaluated
  • abc — 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