New user can't get regex working

What I’m trying to do

Hello,
The help says bracket search term with slashes
My text contains the word “test”
/test/ finds nothing
What am I doing wrong?

What happens is you just search test?

I made an Obsidian note out of the regex documentation and arranged it into sections of syntax that is and is not implemented. Here’s a link: Regular Expressions in Obsidian (copied from mdn web docs)

You can just copy the code styled text within the linked topic into an Obsidian note and it will look and work much better. I included a linked table of contents and have shortened the text within the actual definition tables including links to full descriptions at the bottom of the note. Good luck!

I literally have the word “test” in my document like

Test
test
test

and in the search if I put in “test” in the search field (without quotes) it finds each of the instances but if I put in “/test/” in the search field (without quotes) it finds nothing.

Searching by regex works in the full-vault search (CTRL-SHIFT-F) but not in the single page search (CTRL-F). It would be nice if it worked in both. As a workaround, you can specify the path in the vault search, e.g. path:myfile.md /search/

I couldn’t find a feature request for enabling regex in single-page search. Feel free to enter one.

1 Like

My understanding is that regex can search a vault but not inside a single note.

So a global search such as:

/\d{4}-\d{2}-\d{2}/

…works on the vault but not within a note itself (CMD F).

EDIT: I was writing this post when @Craig replied with the more or less same answer. Left it here because …

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