Regex Tester

Test regular expressions with live match highlighting and groups.

Test a JavaScript regular expression against sample text and see matches highlighted live, with positions and capture groups in a table. It helps developers build and debug patterns safely, since a runaway pattern is stopped after two seconds.

What is a regular expression?

A regular expression is a compact pattern language for matching text. This tool uses the JavaScript RegExp engine, so syntax such as lookahead, lazy quantifiers, named groups written as (?<name>...), and the flags g, i, m, s, u and y behave as they do in your browser. Capture groups in parentheses return parts of each match, numbered from 1. Patterns with nested repetition, like (a+)+$, can backtrack exponentially on near misses, which is called catastrophic backtracking. The tool runs matching in a background worker and stops it after 2 seconds, and it caps the result at 2000 matches. Always test patterns on non-matching input as well.

How to use Regex Tester

  1. Write the pattern Type it in Pattern, without surrounding slashes.
  2. Select flags Tick g, i, m, s, u or y under Flags.
  3. Enter the Test string Paste the text to match. Results update after a short delay.
  4. Read results See the match count, the Highlighted text and the table of index, match and groups.

Frequently asked questions

Which regex flavor is used?

JavaScript's built-in RegExp, as in the browser you are using. PCRE, Python or .NET features such as possessive quantifiers may not work.

Why is there a 2 second limit?

Some patterns take exponential time. Running in a worker with a timeout keeps the page responsive, and a stopped pattern is reported with a message.

Is the match list limited?

Yes. At most 2000 matches are collected and the count then shows with a plus sign. The table displays the first 200 rows.

Do I type slashes around the pattern?

No. Enter only the pattern body and use the flag checkboxes. In code you would write /pattern/flags.

Does the tool send my text anywhere?

No. Matching happens locally in a worker thread of the page.