explain_regex
Explains regex patterns token by token in plain English, flags engine-specific behavior and syntax errors by position for Python, JavaScript, or regex syntax.
Instructions
Explain a regex token by token in plain English, using this server's own parser.
Covers literals, escapes, classes, quantifiers (greedy, lazy, possessive), groups
(capturing, named, non-capturing, atomic), lookahead and lookbehind, backreferences,
anchors and inline flags, and says how each construct behaves in the chosen engine
(for example Python's $ before a trailing newline, or JavaScript's ASCII-only
\d). Constructs it does not model (recursion, conditionals, \N{...}) are marked
"NOT EXPLAINED" rather than guessed. Syntax errors are reported with the position.
Engine-specific syntax that the engine would reject is flagged as ERROR.
engine: "python" (default), "javascript" or "regex" (syntax dialect only; this tool does not need the engine installed). flags: same letters as test_regex; they change the explanation (m, s, a, x, ...).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| flags | No | ||
| engine | No | python | |
| pattern | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |