Regex test
regex_testTest a JavaScript regular expression against text to return matches, indexes, capture groups, and an optional replace preview, with a timeout guard against catastrophic backtracking.
Instructions
Run a JavaScript regular expression against text: every match with its index, length, numbered and named capture groups, plus an optional replace preview ($1, $, $&, $`, $', $$). Flags g i m s u y (and d, v). Runs in an isolated worker with a timeout (default 1.5 s) so catastrophic backtracking is reported instead of hanging. Lists up to 5000 matches. Web version: https://s3eidat.github.io/regex-playground/
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | The text to search. | |
| flags | No | Regex flags, default "g". | g |
| limit | No | Max matches to include in the result (count is still total). Default 500. | |
| pattern | Yes | The regex source, without slashes, e.g. "(\\d+)-(?<w>[a-z]+)". | |
| replace | No | Replacement string for a replace preview (JavaScript String.replace syntax). | |
| timeoutMs | No | Kill the regex after this many ms. Default 1500. |