Match the parent tag without matching the child

What I’m trying to do

Let’s say I have three notes:

This is note 1, only tagging the #parent
This is note 2, tagging both #parent in this section..

and a #parent/child in this one
This is note 3, only tagging the #parent/child

I’m trying to build a search query that would match notes 1 and 2, but not note 3.

I tried it with tag:#parent -tag:#parent/child, but that, of course, only returns note 1.

Found a solution with regex: /(\#parent)(?!\/)/ , but would still be happy to hear a more user-friendly one.

This doesn’t help you now, but if tag:child would match #parent/child then you could do tag:parent -tag:child. Might be worth a feature request.

Or a request for a feature to search for a parent tag without its children, so you don’t have to remember and exclude every child. I thought there was an existing request for that but I don’t see it.

Longer than the regex but more readable: tag:parent -#parent/child.

To exclude all children: tag:parent -#parent/.

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