Handy Orchard

JavaScript regex tester

Test JavaScript regex matches, capture groups and string replacement in a cancellable worker with a time limit.

Your input

JavaScript replacement tokens such as $1 are supported; no replacement function or user code runs.

Outputs are cleared when the input changes.

Result

Enter your data or use the example, then run the tool.

Worked example

(a)(b) with g on ab ab returns two matches, each with groups a and b; $2$1 previews ba ba.

Empty matches advance safely. Catastrophic backtracking is stopped by terminating the worker.

Method

Construct RegExp only inside a dedicated worker; exec results include UTF-16 indices and capture groups.

Advance empty matches by code point in Unicode mode. Replacement uses bounded JavaScript string-token semantics, not executable functions.

Limits

Pattern at most 10,000 UTF-8 bytes, text at most 100,000 UTF-16 units, 1,000 matches and two-second worker timeout.

JavaScript syntax only, not PCRE/Python. Unsupported flags are errors; a truncated match list never produces a claimed-complete replacement.

Sources

MDN: JavaScript RegExp semantics

Related tools

Regex structure inspectorGlob pattern testerJavaScript AST explorer

Your inputs stay on this device. Only optional, consented page visits are measured. Input values, files, filenames and processing logs are not sent to Analytics.

When switching languages, text, settings and selected files are temporarily kept on this device. Transfers are removed after restoring; interrupted transfers are cleaned up on a later visit. Inputs and files are never uploaded.