Or perhaps like this, because adding a space will not work if you have a line break after the tag.
```query
tag: #todo -"todo/"
```
The only problem with this query is that the -“todo/” queries notes, not tags. So if you have #todo in one part of your note, but #todo/foo later in the note, then it won’t return the note at all. So maybe there is a better query to use.
As rigmarole suggests below, it isn’t just the ending but also the beginning that is at issue. If I add use “space#todospace” then I miss out on all tags that start at the beginning of a line.
If I remove the first space results include links files that include subheadings, e.g., [[Link to this file#ToDo]]
Oddly enough, tag: #todo -tag:#todo/ in search still includes a file that is tagged with #todo/sometime. I would have thought the last forward slash might have prevented that, but alas.
My example uses a content query. You are searching for the tag #todo/ which is not the same as #todo/sometime. The tag query is an exact match, not fuzzy. (I don’t know if there is a way to make it fuzzy, or use wildcards.)
I think I’ll just give up on nested tags. I only just tried them in the last couple of days, and if it is this problematic to do what should be a simple query, I can’t imagine what it would be like to do more complex queries with them.