patch_note
Find and replace specific text in a Trilium note without rewriting the entire content. Specify occurrence to disambiguate multiple matches, ensuring precise edits.
Instructions
Find-and-replace a piece of a note's content without resending the whole note. Rejects the call if "search" matches zero or more than one location, unless "occurrence" is given to disambiguate.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| noteId | Yes | ID of the note to patch | |
| search | Yes | Literal text (or regex pattern, if isRegex is true) to find in the note content | |
| isRegex | No | Treat "search" as a regular expression instead of literal text (default: false) | |
| replace | Yes | Text to replace the match with | |
| occurrence | No | 1-based index of the match to replace. Required when "search" matches more than one location. | |
| contentFormat | No | Format "search" and "replace" are expressed in: "markdown" (default, matches what get_note returns) or "html" (the raw stored format) | markdown |