replace_preview
Preview regex substitutions by showing each match, its expanded replacement, and the final text across Python and JavaScript engines, with warnings for syntax that differs between them.
Instructions
Preview a regex substitution: every match, what it becomes, and the final text.
The replacement is expanded by each engine's own template rules, so the preview shows what the code will really do. Python uses \1, \g<1> and \g; JavaScript uses $1, $, $&, $` , $' and $$. If the replacement uses the other language's syntax (a common bug: "$1" in Python is literal text) a WARNING says so, and differing results between engines are called out.
engines: any of "python", "javascript" (or "js"), "regex"; default all available.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| flags | No | ||
| engines | No | ||
| pattern | Yes | ||
| subject | Yes | ||
| timeout_s | No | ||
| max_matches | No | ||
| replacement | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |