Skip to content

Regex Tester

Tests JavaScript regular expressions against text, highlighting every match and showing capture groups.

Your text stays on this device

This tool runs entirely inside your web browser. Your text is processed on your own device and is never sent to our servers. How this works

Matches

Type a regular expression to see matches highlighted.

Regex Tester is a free tool for writing and debugging regular expressions. It highlights every match in your test text as you type, lists capture groups and their positions, and supports the i, m, s and u flags. It uses the JavaScript regex engine, runs in your browser, and stops runaway patterns before they can freeze the page.

How to test a regular expression

  1. Type a pattern in the top box, without the surrounding slashes.
  2. Paste text to search in the left box.
  3. Matches are highlighted on the right, followed by a list of each match with its position and groups.

Flags

Quick reference

Slow patterns

Some patterns, such as (a+)+$, can take an astronomically long time on certain text because the engine tries every possible combination. This is called catastrophic backtracking and is a common cause of frozen web pages and server outages. The tester stops any pattern that runs longer than 1.5 seconds and tells you, so you can fix it before it reaches production.

To apply a pattern to text, use Find and Replace with regular expressions turned on.

Frequently asked questions

Which regex flavour does this use?

JavaScript (ECMAScript), as used in browsers and Node.js. Most syntax matches other languages, but features like lookbehind or named groups can differ from Python, PHP or Java.

Why was my pattern stopped?

Patterns with nested repetition, such as (a+)+$, can take practically forever on some text (“catastrophic backtracking”). The tester stops any pattern that runs longer than 1.5 seconds instead of freezing your browser.

Is the g flag needed?

The tester always finds every match. Choose the other flags (i, m, s, u) as needed.

Last updated

Missing a feature, or need a tool we don’t have? Suggest it.