Skip to content
MagicDocTool

Regex Tester

Write and debug JavaScript regular expressions with live match highlighting, capture groups, replace preview and a handy cheat sheet.

Runs in your browser — your data never leaves your device

Flags

Highlighted matches

2 matches
Contact hello@magicdoctool.com or support.team+help@example.co.uk. Not an email: user@localhost

Replace

Turn on replace mode to preview a substitution using captured groups.

Match details

  1. 1hello@magicdoctool.comindex 8–30
  2. 2support.team+help@example.co.ukindex 34–65

How to use Regex Tester

  1. 1

    Enter a pattern

    Type your regular expression and toggle flags such as g, i, m, s, u and y.

  2. 2

    Add test text

    Paste sample text — every match is highlighted and listed with its groups.

  3. 3

    Try a replacement

    Switch on replace mode to preview the output using $1 or $<name> references.

Frequently asked questions

Which regex flavour does this tester use?

It uses your browser’s native JavaScript (ECMAScript) RegExp engine, so results match exactly what String.match, replace and RegExp.exec do in Node.js and modern browsers — including named groups, lookbehind and Unicode property escapes.

Why do I only see one match?

Without the g (global) flag a JavaScript regex stops after the first match. Turn on g to find every occurrence; add m if you want ^ and $ to match at the start and end of each line.

How do I reference capture groups in a replacement?

Use $1, $2 … for numbered groups, $<name> for named groups, $& for the whole match and $$ for a literal dollar sign. Enable replace mode to preview the result live.

Is my test data uploaded anywhere?

No. Matching runs entirely in your browser and nothing is sent to a server. To keep the page responsive, the tester lists at most 1,000 matches and safely steps past empty matches.