Skip to content

RegExp Replace In Note

This button action allows you to do a search and replace on the entire note where the button is in.

interface RegexpReplaceInNoteButtonAction {
type: 'replaceInNote';
regexp: string; // the regular expression to search for
regexpFlags?: string; // the regexp flags for the regular expression, defaults to `g` if omitted
replacement: string; // the replacement text
}

You can use $1, $2, etc. in the replacement text to reference the matched groups in the regular expression.

Example

This example replaces every TODO: ... line with TODO: ... - Done.

```meta-bind-button
style: primary
label: RexExp Replace In Note
action:
type: "regexpReplaceInNote"
regexp: "^(TODO: .*)$"
regexpFlags: "gm"
replacement: "$1 - Done"
```