Tag Refactoring

I have started down one path with organizing my notes via a set of tags and would like to change my approach. Is there a plugin that will let me do refactoring type activities such as:

  • add a specific tag and value to a targeted collection of notes (e.g. in a specific folder, or with a specific tag value)
  • Change/Update notes with a specific tag value to a new value
  • Remove/Clear a tag value from a targeted collection of notes.

Any help/advice would be appreciated.
Thanks in advance.

What I’m trying to do

Tag Wrangler can “Change/Update notes with a specific tag value to a new value”. It can’t do the other 2 things, but both might be good feature requests for it.

I think there might be something that can “add a specific tag and value to a targeted collection of notes”, but I don’t know what.

I don’t think there’s a plugin that can " Remove/Clear a tag value from a targeted collection of notes.", but I could be wrong.

1 Like

Thanks for this. I will check out Tag Wrangler.

Most of this things could be done with notepad++.
Replace and replace in files are the 2 main features to do this.
Notepad++ is a separate program for text files.

Hmm…good idea.
Thanks for reminding me to think outside the Obsidian box.
I’ve heard of Notepad++. Will check this out.

Definitely double-check and use backups when using using mass search-replace, because it’s easy to accidentally replace things you didn’t mean to (less of a problem with tags but still possible; using regular expressions with word boundaries should help).

Also if you use a tags: field in YAML front matter you’ll need to do another, fancier search-replace.

Hi, @CawlinTeffid - you raise a good point. Most of my tags are in the YAML front matter. But I can see now thanks to you that the search engine by default doesn’t know the difference between a colon appearing the YAML front matter vs a colon appearing in regular content. Can you recommend a way to “another, fancier search-replace?” Are you thinking about maybe searching for the tags and using other nearby tags as “context” so to speak?

For replacements I would use Tag Wrangler because it uses Obsidian’s index which includes YAML tags.

For deletions I would consider a hack: assign a single tag as the “trash bin” (maybe #deletedtags), and use Tag Wrangler to change tags you want to delete with that tag (Tag Wrangler will ask for confirmation when change a tag’s name to another existing tag name). It’s a little inelegant but I think safer than trying to correctly match tags with a plain text search.

If you want to use an external program, a “fancier” search-replace would be something like a regular expression matching strings that start with "tags: " at the start of a line, include 0 or more characters before the tag you’re replacing, and 0 or more after it. The expression would need the various parts enclosed in parentheses so you could replace them properly.

1 Like

Got it. Will try that out this weekend. Thanks again.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.