Encoders & Text

Regex Tester

Test patterns against text with match highlighting, groups, and an explanation.

  • History kept on this deviceRecent results are kept in this browser's local storage until you clear them.
  • Runs in your browserProcessing happens in this page. No application server receives your input.

Subject text

Matches

#MatchIndexLengthCapture groupsNamed groups
Matches appear here.

Highlighted subject

Pattern explanation

Enter a regular expression pattern to see its token-by-token explanation.

What this tool does

Evaluates JavaScript regular expressions against a subject string inside a dedicated background worker (`regex.worker.ts`), highlights every match in the subject, lists capture groups and named groups (`?<name>`), previews `.replace` / `.replaceAll` output when a replacement template is supplied, and explains the pattern token by token.

How it works

Every evaluation runs off the main thread in `regex.worker.ts` (`ADR-13`). If a pattern with nested quantifiers causes catastrophic backtracking and does not finish within 2 seconds, the host cancels and terminates the wedged worker while keeping the UI responsive and highlighting the nested quantifier in the explanation table below.

Supported syntax & explanation constructs

  • Anchors & boundaries: ^, $, \b, \B
  • Character classes & escapes: ., \d, \D, \w, \W, \s, \S, [...], [^...]
  • Groups & lookaround: (...), (?:...), (?<name>...), (?=...), (?!...), (?<=...), (?<!...)
  • Quantifiers & alternation: *, +, ?, {n}, {n,}, {n,m} (plus lazy ?), and |

Limits

JavaScript regex only; no PCRE, Ruby, or .NET syntax. The explanation covers the constructs listed below and falls back to naming a token it cannot describe. Matching stops at 10,000 matches or 2 seconds.

Scope: this covers the page itself. Your browser, operating system, clipboard, downloads, extensions, and crash recovery may keep copies, and a compromised site origin would not be protected.