Use case or problem
I commonly edit files using regular expressions. This isn’t possilbe yet.
Proposed solution
Implement a regex search and replace function for content editing. E.g., like the one in VS Code
Current workaround (optional)
Ctrl+P
→ Open in default application
[opens file in VS Code] edit the file using regex.
I’d love to stay within obsidian.
9 Likes
Thanks for adding some more workarounds.
Unfortunately, these are just that: Workarounds.
Would be great if RE would be supported natively.
RE is one of the key features for editing plain text files, IMHO (same goes for beancount for accounting, etc.) It’s so powerful…
2 Likes
Regex Find/Replace works well for me both for normal and regex search&replace in a single file.
(my hotkey: Alt+Shift+R)
If I only want part of the page changed I enable Replace only in selection
(PS: the button still reads “Replace All” but it actually only makes changes in the area I preselected)
\\\\\\\\\\\\\\\\\\
My personal tags are all prepended with a hyphen “-”
e.g.
#-cs-km-obsidian-
#-cs-prog-regex-
I do this so that they might stand out in a graph but mainly so that I can easily regex search for them.
Quite often when I capture stuff I tag it e.g. with #-cs-km-obsidian- AND
#-cs-prog-regex- BUT it will also contain tags made by others #notMyTag #notMyTagEither polluting my tag hierarchy.
… so with Regex Find/Replace
FIND
#[^#\s\W-]
REPLACE WITH
T$&
$& meaning.
e.g.
BEFORE
#-cs-km-obsidian-
#-cs-prog-regex-
#notMyTag
#notMyTagEither
AFTER
#-cs-km-obsidian-
#-cs-prog-regex-
T#notMyTag
T#notMyTagEither
i.e. the ones with T in front won’t appear in my tag hierarchy but I can still easily find them if I wanted.
\\\\\\\\\\\\\\\\\\\\
Global Search and Replace for Obsidian can do a global regex search & replace through all the markdown files in your vault. I am very careful with this one as I’ve , in the learning process, made changes I didn’t intend to.
It would be great if this could be implemented in the core app, similar to how it’s implemented in VS Code - the plugins are broken/unmaintained.
2 Likes