Regex functionality for find and replace within obsidian

I’ll add my support for this, mostly due to the fact that mobile doesn’t support Vi mode and hence has no way to do this.

4 Likes

I’m starving without this feature, please, implement it! For now I have to open my notes in Sublime or VS Code, and I use regex search and replace every day, so this is not very convenient.

2 Likes

+1. It would make so many things easier!
I use atom now, but would be great not having to mess with my vault files with another editor (even if I can).

1 Like

+1 Very userful

I just released the first version of a plugin which adds this ability here: GitHub - nothingislost/obsidian-regex-search-replace: Plugin to enhance the functionality of Obsid

It’s not in the plugin repository yet so it needs to be installed manually for now. If anyone wants to test it out and provide feedback via Github issues, feel free.

Note: it does not support replacing text using regex capture groups yet but I will see if I can add support for that.

5 Likes

The latest release adds support for replacements using capture groups.

11 Likes

Hi the plugin no longer works. Do intend to support this plug in in the future?

1 Like

+1 - Would be super useful

1 Like

I hope I can use regex in find and replace before I die!

1 Like

How about this one: Gru80/obsidian-regex-replace

1 Like

@Kohomologia I’ve used this plugin for one-shot regex find and replace. I also use Regex Pipeline for searches I use often (e.g. preparing a note to publish on micro.blog). It’s a little wonky, but it works once it’s configured. You can store single searches or a workflow, hence the name, Pipeline. I’ve combined it with Commander macros to automate my blog post workflow.

One other option is TextSoap. It has a nice interface for building multiple step Regex and plain search & replace workflows, along with file handling steps. It also includes a daemon that allows you to process any selected text in pretty much any application—I can run it on an Obsidian note without having to copy to an external file. The app costs a bit (I get it with my SetApp subscription), but it’s not out of line if you use it a lot.

+1 for regex find/replace

That would be a great feature. I know there is a plugin, but it’s unmaintained and doesn’t do what I need most, that is just replacing the next match.
Sometimes, with VS Code, I write a regex and don’t know if it does exactly what it should or match anything wrong, so what I do is just replace the next match, instead of replacing all matches or even the ones from selected text (what the plugin allows).
That could be implemented in the search in the current file, but also in the global search.
A nice trick that would be wonderful, is using sed’s syntax for find and replace: s/<matching string>/<replacement string>/[<options>].

1 Like

+1 for this feature

+1 pleeeeeeeeease regex is a must have when editing large amount of notes