Regex Tester Test and debug regular expressions with live match highlighting — free, fast, private.

Regex Tester

Test and debug regular expressions with live match highlighting — free, fast, private.

What is a regex tester?

A regex tester is an online scratchpad for regular expressions: you type a pattern and a sample text, and the tool instantly shows which parts of the text match, where each match starts, and what every capture group caught. Instead of editing code and re-running a script, you see the effect of every change live, which makes it the fastest way to build, debug and fine-tune a regular expression.

How to use this tool

  1. Type or paste your pattern into the pattern field — without the surrounding slashes.
  2. Toggle the flag checkboxes (g, i, m, s, u, y) to change how the engine matches.
  3. Enter a test string: matches are highlighted live and listed below with their index and capture groups.
  4. For find & replace, type a replacement$1, $2 … insert capture groups — then copy the result.

Quick cheatsheet

Common regex mistakes (and how to fix them)

Worked example: swap names with find & replace

Test string: Smith, John. Pattern: (\w+), (\w+). Replacement: $2 $1. The match list shows $1 = Smith and $2 = John, and the replace output reads John Smith. Add more names on separate lines and enable the g flag (on by default) to convert the whole list at once, then press Copy result.

Frequently asked questions

What is a regular expression?

A regular expression (regex) is a compact pattern language for describing sets of strings. It is used to search, validate, split and transform text — for example checking that an email address looks valid or extracting every date from a document.

What do the flags g, i, m, s, u and y do?

g (global) finds every match instead of stopping at the first; i makes matching case-insensitive; m lets ^ and $ match at line boundaries; s (dotAll) lets the dot match line breaks; u enables full Unicode mode; y (sticky) forces the match to start exactly at the current position.

Which regex flavor does this tester use?

It uses the JavaScript flavor — the patterns you type are compiled by your own browser's RegExp engine. Modern features such as lookbehind and named capture groups work in all current browsers, and the results you see are exactly what JavaScript would produce.

How do I match special characters like a dot or an asterisk literally?

Prefix them with a backslash: \. matches a literal dot, \* a literal asterisk, \( and \) literal parentheses, and \\ a literal backslash. Inside a character class most special characters lose their meaning, so [.] already matches a plain dot.