Skip to main content

Regex Roulette · #42 · 2026-05-16

Match URL-friendly slugs (lowercase letters, digits, hyphens, no leading/trailing hyphens)

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

  • hello-world — not yet evaluated
  • my-post-123 — not yet evaluated
  • a — not yet evaluated
  • test — not yet evaluated

Must not match

  • -leading — not yet evaluated
  • trailing- — not yet evaluated
  • UPPER — not yet evaluated
  • has space — not yet evaluated
  • double--hyphen — 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