Regex Tester
Enter a regex and test text to see highlighted matches and capture groups in real time. Matching runs in a Web Worker and is stopped automatically after 2 seconds, so a bad regex can never freeze the page. Everything runs locally; nothing is uploaded.
//
Examples:
Match Results
Not run yet.
Notes
- Backtracking protection: matching runs in a separate Web Worker thread, so the main thread never freezes; a single match taking over 2 seconds is force-stopped with a timeout message. Common causes are nested quantifiers such as
(a+)+$and(a|a)*. - Match limit: at most 1000 matches are shown per run; more are truncated with a notice.
- Flags: g global, i case-insensitive, m multiline, s dot matches newlines, u Unicode, y sticky (matches only from the last position).
- Privacy: the regex and text are processed only in your browser and never sent to any server.
FAQ
- What is a regex tester? It lets you try a regular expression against sample text and see the matches immediately: which parts match, what each capture group caught, and how flags change the result.
- How does this tool protect against catastrophic backtracking? Matching runs in a Web Worker with a 2-second watchdog. If a regex takes longer than 2 seconds, the worker is terminated and you get a timeout message with rewrite advice, so the page never freezes.
- Does this tool upload my regex or test text? No. Everything runs locally in your browser; nothing is sent to any server.
- Which regex flags are supported? g (global), i (case-insensitive), m (multiline), s (dot matches newlines), u (Unicode) and y (sticky). Group positions use the d flag internally.
- What are named capture groups? Named groups like
(?<year>\d{4})capture part of a match under a name instead of a number. This tester lists every named group's value and position for each match.
More tools are coming. Back to thetool list.