Test a regular expression
test_regexValidate a regular expression against sample text to see matches, positions, and capture groups; invalid patterns return clear error messages.
Instructions
Run a regular expression against text and report every match with its position and capture groups. An invalid pattern comes back as an error message rather than an exception. Use it to check a pattern actually does what it looks like it does.
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": "test_regex"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | The text to search. | |
| flags | No | Any of i (ignore case), m (multiline), s (dotall), x (verbose). | |
| pattern | Yes | The regular expression, in Python syntax. |