$ regex-tester

Test patterns, visualize matches, and learn regex with live explanations and safety hints.

Regex Workspace

Enter a pattern and test text to see live matches and explanations.

Flags

The global flag (g) is automatically enabled for match highlighting. Active flags: none.

Characters: 0

Live Match Output

0 matches
No input.

Capture Groups

No matches yet. Try another pattern or test string.

Plain-English Explain

Enter a pattern to see the explanation.

Regex Flow

Visualization appears here.

Diagrammatic view provides a quick token flow preview.

Code Snippet

const pattern = "";
const flags = "g";
const regex = new RegExp(pattern, flags);

const matches = [..."your input".matchAll(regex)];
console.log(matches);

Regex Cheat Sheet

Character Classes

  • . Any character except newline (unless /s).
  • \d Digit [0-9].
  • \w Word character [A-Za-z0-9_].
  • \s Whitespace.
  • [abc] Any of a, b, or c.
  • [^abc] Any character except a, b, or c.

Anchors

  • ^ Start of string/line.
  • $ End of string/line.
  • \b Word boundary.

Quantifiers

  • * 0 or more (greedy).
  • + 1 or more (greedy).
  • ? 0 or 1 (greedy).
  • {m,n} Between m and n times.
  • *? 0 or more (lazy).

Groups & Alternation

  • (...) Capturing group.
  • (?:...) Non-capturing group.
  • (?=...) Positive lookahead.
  • (?!...) Negative lookahead.
  • | Alternation (OR).

Common Patterns