Test a regular expression
regex_testRuns a JavaScript regular expression against text and returns every match with its position and capture groups, or the text after replacement. Use it to verify a regex actually works before relying on it.
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>",
"text": "<text>"
},
"name": "regex_test"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | ||
| flags | No | Optional flags: i (ignore case), m (multiline), s (dotall), u (unicode), y (sticky). Global matching is always on. | |
| pattern | Yes | Regex pattern without slashes, e.g. "(\\d{3})-(\\d{4})" | |
| max_matches | No | Default 100 | |
| replace_with | No | Optional replacement string ($1, $<name> supported). If set, returns the replaced text too. |