Skip to content
DevToolPilot

Text & Code

Regex Tester

Test a JavaScript regular expression, highlight matches, inspect capture groups, and preview a replacement.

Processed locally. Nothing from the editor is stored.

How to use Regex Tester

Patterns use the JavaScript RegExp engine, the same engine a browser uses. Flags are g, i, m, s, u, and y. Matching runs in a worker that is stopped if it takes too long, and nested quantifiers are rejected before they run.

  1. Enter a pattern and toggle flags. Global is on by default so every match can be highlighted.
  2. Paste the test text and an optional replacement. Choose Run, or press Control+Enter or Command+Enter.
  3. Read the highlighted matches and the group table. A timeout means the pattern needs to be simpler.

Examples

Capture an email local-part

(\w+)@(\w+\.\w+) on ada@example.com reports group 1 as ada and group 2 as example.com.

Preview a rename

Replacement [$1] wraps the first capture. The original test text stays in the input.

Questions

Which regex flavor is this?

JavaScript. Lookbehind and named groups work when the browser supports them. Possessive quantifiers and atomic groups do not.

Why was my pattern rejected?

A quantified group that itself contains a quantifier can take exponential time. Rewrite it, or test a shorter pattern that does not nest * or +.

Related tools