search_and_replace
Batch find and replace text in Word documents across body, footnotes, headers, or all. Supports regex, tracked changes, and an abort limit when matches exceed the maximum.
Instructions
Batch find/replace, safe across Word's fragmented runs. Each item:
{find, replace, regex?}; scope: body | footnotes | headers | all.
max_replacements aborts, changing nothing, when total matches would
exceed it: set it for broad regexes (preview_replace dry-runs this tool
and yields the count). track records each replacement as a tracked
change by author. Siblings: replace_formatted replaces only text with
specific formatting; replace_paragraph_text rewrites one whole
paragraph by index. Live edits appear immediately as one Ctrl+Z step,
unsaved until the user saves; the live result adds "live": true and
skip counters, and literal finds beyond Word's ~255-char limit are
handled automatically. Auto-backup in file mode: prev/anchor slots in
.ks4w-backups (backup=False skips rotation only); atomic validated
save. Documents open in Word are edited live.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| live | No | auto | |
| scope | No | body | |
| track | No | ||
| author | No | Claude | |
| backup | No | ||
| file_path | Yes | ||
| replacements | Yes | ||
| max_replacements | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||