Test a regex on real engines
test_regexRun a regex on JavaScript, Python, PCRE2, and RE2 engines to compare matches, groups, replacement results, compile errors, and disagreements, including ReDoS risk.
Instructions
Runs a regex on real engines: JavaScript (V8), Python (CPython re), PCRE2 (PHP, grep -P), RE2 (Go, BigQuery). Each gives its compile error with position, or every match with groups and named groups, and the replacement result in its own syntax. Positions are in characters. Lists where engines disagree.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"pattern": "<pattern>",
"inputs": "<inputs>"
},
"name": "test_regex"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| flags | No | any of i m s x u | |
| inputs | Yes | ||
| flavors | No | default all four | |
| pattern | Yes | ||
| max_matches | No | ||
| replacement | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| engines | Yes |