I want to filter the notes in the folder called “How to” (placed in my root folder).
Things I have tried
In the filter section of the graph view I added -path:"How to".
However, this filters also other notes that are in the root folder that have “how to” in their name - and even the ones that have only “how” in the name and “to” in the text.
Is there a way to only filter folders, and not notes in the root folder?
@CawlinTeffid thanks for the reply, however -path:(/How to/) does not filter neither the folder nor the notes, and -path:"/How to/" filters the folder but still filters the notes…
BTW on the point of matching also “how” and “to” in the text I was wrong sorry, it’s only when how to is in the text!
Whenever you start using / in the filter expressions, you enter the realm of regex. This can help you a lot, or confuse you a lot.
As I see it your request has two key parts:
Match folders in the root either starting with, or matching “How to”
Do not match files in the root folder having “How to” in the name
Both of these can be addressed with regex, and for easier verification I suggest doing the preliminary tests in the search pane.
Starting with “How to”
Try out path:/^How to.*?\//, which can be explained as match against the full file path which:
Starts with, ^, the leading text `How to``
Followed by the shortest random text, .*?, still matching the rest
Where the rest is an actual slash, \/, which is an indicator that the path will continue with more files and/or folders, so it rules out notes in the root folder
If only “How to”
If you need to match against the exact variant of the folder “How to”, this regex can be simplified to, path:/^How to\//, which has the same explanation, but it doesn’t allow anything between the “How to” and the literal slash.
I’m sorry if I implied that, but it doesn’t look like it either.
path: /^[zxyw]/ is in no way the same as path: "/^[zxyw]/". Sorry for any confusion. The first looks for path starting with any of the letters “zxyw”, whilst the second looks for a file path starting with that exact text (and I wonder who in their right mind would start a file path with that! :-D)