replace_regex
Replace regex matches in a file only when the number of matches equals an expected count, ensuring precise edits.
Instructions
Replace regex matches only when the exact expected occurrence count matches.
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": {
"path": "<path>",
"pattern": "<pattern>",
"replacement": "<replacement>"
},
"name": "replace_regex"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bom | No | preserve | |
| path | Yes | ||
| dotall | No | ||
| newline | No | preserve | |
| pattern | Yes | ||
| encoding | No | preserve | |
| base_hash | No | ||
| replacement | Yes | ||
| final_newline | No | preserve | |
| case_sensitive | No | ||
| expected_occurrences | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |