Skip to content

Developer tools

Regex Tester

Test a regular expression against sample text and see every match, capture group, and named group. Live results, no server round trip.

Runs on your device — nothing is uploaded

Write a regular expression, paste some sample text, and see exactly what matches — including every capture group and its position in the string.

How to use this tool

  1. Type your pattern without the surrounding slashes: write \d+, not /\d+/g.
  2. Tick the flags you need.
  3. Paste test text underneath.
  4. Every match is listed with its index and any groups it captured.

What the flags do

  • g (global) — find every match instead of stopping at the first
  • i (ignore case) — treat A and a as the same
  • m (multiline) — make ^ and $ match at each line break, not just the start and end of the whole string
  • s (dotall) — let . match newline characters too
  • u (unicode) — enable \p{...} property escapes and correct handling of characters outside the basic plane

Tips

  • Use named groups(?<year>\d{4}) — and they appear by name in the results. Far easier to maintain than counting bracket positions.
  • \b marks a word boundary and is usually what you want instead of wrapping a pattern in spaces.
  • Beware catastrophic backtracking: nested quantifiers like (a+)+b can take exponential time on a non-matching string. This tool caps results to keep the page responsive, but the underlying pattern would still be slow in production.
  • This uses the JavaScript regex engine. PCRE, Python, and Go differ in places — notably lookbehind support and named-group syntax.

Related tools

FAQ

Is my text sent to a server?

No. The pattern is compiled with the browser's own RegExp engine and run locally.

Why does my pattern only find one match?

You almost certainly need the g flag. Without it, the engine stops at the first match by design.

Why is my pattern with a lookbehind failing?

Lookbehind — (?<=...) — is supported in all current browsers but was a late addition. If you are copying a pattern from a Python or PCRE example, also check the escape syntax, which differs.

How do I match a literal dot or slash?

Escape it with a backslash: \. for a dot, \/ for a slash. Inside a character class, [.] also works and reads more clearly.

Does this support replace?

Not yet — this tool focuses on matching and group inspection so you can get the pattern right first.

More developer tools

Try these next