How can I multi-link large instances of a keyword all at once?

Use Visual Studio code, there is no way currently to do it inside Obsidian. This will show you how to link every instance of a keyword.

Disclaimer* Make sure to make a backup of the vault before trying this. Also, this doesn’t show if you don’t want every instance of a keyword. I don’t know what to do if you still have a thousand keywords you want to add but exclude some.

If you have the free version of Visual Studio Code do the following below.

Open “New File” and insert your vault.

Go to the search tab (command + shift + f for Mac users)
Under “Files to include” add “.md” so that any javascript files or other files are excluded and you don’t break your vault by accident.

Select both of the two boxes next to the search textbox (Match Whole Word, and Use Regular Expression).

Insert the following code into the search box. This search box allows some variations of regex operations (Javascript based regex for free version).


Now pull up the replace option by pressing command + shift + h.

Insert the bracket version of the keyword like this into the replace textbox:


Next to the replace textbox select the replace all box. This will save changes even if you don’t have auto-save on (tested on version 1.76.2) and apply the replace on all files in the vault.

Obsidian will index and all the links will update.

Additional info:
“#” is excluded from the word search and up to two whitespaces are searched for to be excluded if preceded by a “#” character. This is because markdown uses these # in the title and we can’t currently have square brackets in title of markdown files for Obsidian. Negative lookbehinds in this regex won’t allow specific length from what I’ve experimented with that’s why I have it that way.

Wrapping the text in a code block allows all the characters to appear on the forum:




I decided to add this Q & A because I didn’t find anyone else provide guidance on this process nor an internal plug-in available or outside plug-in I trusted. If anyone knows dangers here I haven’t shared please do. I did this because this isn’t a feature or it is that the process isn’t widely publicized. Also I have this repository tracked by Git and it hasn’t had any issues with allowing me to do this.

Disclaimer edit* Also I don’t know how you would do this if your keyword affects other plug-in features that don’t allow square brackets or html/css/yaml areas of your code that are in .md files.

1 Like

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