Skip to content

Regex tester

Runs on your device

Test JavaScript regular expressions with live highlighting, capture groups and replace, safe from patterns that hang.

//gu
Flags

How to use Regex tester

  1. Type the pattern, without the surrounding slashes.
  2. Switch flags on or off: global, ignore case, multiline, dot matches newline, unicode.
  3. Paste test text. Matches are highlighted and capture groups listed as you type.
  4. Optionally enter a replacement to see the replaced text.

Live matching

Type a pattern and test text, and matches are highlighted as you type. A table lists every match with its capture groups, including named groups such as (?<year>\d{4}), so you can see exactly what each group captured. The flags work as in JavaScript: global finds all matches, ignore case, multiline makes ^ and $ match at line breaks, dot-all lets . match a newline, and unicode enables \p{…} property escapes.

Enter a replacement to preview the result of replacing, with $1 for numbered groups, $<name> for named groups and $& for the whole match. The replaced text appears below as you type, ready to copy.

Safe from runaway patterns

Some patterns take exponential time on certain inputs: (a+)+$ against a long row of a's followed by a b is the classic example. In most regex testers that freezes the browser tab. Here every test runs in a background worker; if it takes longer than 1.5 seconds, the worker is stopped and the tool explains that the pattern backtracks catastrophically, which is also a warning that it could hang your production code.

Exactly your browser's engine

Patterns run on the JavaScript regex engine built into your browser, so a pattern that works here works the same in your front-end or Node code. Up to 1,000 matches are listed, and the first 100 appear in the groups table. Nothing you type is saved or sent anywhere.

Common uses

Writing a validation pattern for a form field, extracting IDs from log lines, building a search-and-replace for a refactor, or checking why a pattern matches more than you expected.

Examples

\b\d{4}-\d{2}-\d{2}\b finds ISO dates like 2026-10-11. (?<user>[\w.+-]+)@(?<domain>[\w-]+\.[\w.]+) captures the two halves of an email address in named groups. With the replacement $<domain>, every address is replaced by its domain. Turn on ignore case to match words regardless of capitals, and multiline when ^ should mean the start of every line.

Questions

What happens with a pattern that never finishes?
Patterns run in a background worker. If one takes more than 1.5 seconds, usually because of nested quantifiers like (a+)+, the worker is stopped and the tool tells you why. Your tab never freezes.
Which regex flavour is this?
JavaScript's, as built into your browser, including named groups (?<name>…), lookbehind and Unicode property escapes. Patterns behave exactly as they will in your JavaScript code.
Is my text sent anywhere?
No. Matching runs in your browser and nothing is saved.