Search And Replace In Periodic Note

"Periodic Note" is a collective term for Daily, Weekly, Monthly, Quarterly and Yearly Notes. In v1.3+, Periodic Notes replace what was previously only available for Daily Notes.

🚨 Working with Daily Notes requires either the core Daily Notes plugin or the Periodic Notes community plugin. Working with Weekly, Monthly, Quarterly or Yearly Notes requires the Periodic Notes community plugin.

Screenshot of the action

This action searches for a text string or regular expression pattern in the current Daily/ Weekly/ Monthly/ Quarterly/ Yearly Note and replaces it.

Regular expressions must be valid JS expressions, please see MDN web docs (unaffiliated) or RegExr (unaffiliated) for detailed information.

This action returns an error if there is no Daily Note for the current date, so it's best to use it after the "Check For Existence Of Daily Note" action has determined that it actually exists.


Available Options

Search term is a regular expression

By default, the search term is searched for as-is. With this option enabled, the search term is treated as a regular expression instead, and must follow the format /search term/ (trailing flags are allowed).


Examples

Suppose you have a current Daily Note with the following content:

Today is a good day.

There's a number of options — and lot of fun to be had! 😉


Searching for a string and replacing with another string

With the search term Today and the replacement Tomorrow , the result will be:

Tomorrow is a good day.

Screenshot of the action, made with AFO v1.2 when only Daily Note was supported.


Searching for a regular expression and replacing with a string

With a regex search term of /[oa]/ig (meaning: all "o" or "a" characters, case-insensitive) and the replacement string ui , the result is:

Tuiduiy is ui guiuid duiy.

Screenshot of the action, made with AFO v1.2 when only Daily Note was supported.


Searching for a regular expression and replacing with capture groups

Using regex together with capture groups is a powerful combination. For example, if a search term is /(my) (note)/ , and the note in questions contains "my note", then "my" and "note" will be available in the replacement as $1 and$2 , respectively.

Here's a concrete example: With a regex search term of /([oa])d([oa])/ig (meaning: an "o" or "a" character followed by a "d" followed by an "o" or "a" character, case-insensitive) and the replacement string $2d$1 (meaning: the second capture followed by a "d" followed by the first capture), the result is:

Tadoy is a good day.

But if you run it again:

Today is a good day.

Screenshot of the action, made with AFO v1.2 when only Daily Note was supported.


Changes / History

v1.3

  • Replaces the hard-coded Daily Note target with the ability to select Daily, Weekly, Monthly, Quarterly and Yearly Notes.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Carlo Contact Carlo