Finding files without tags via regex search?

I’d like to do a search for notes that aren’t tagged with anything. I could search for -"#" but that pulls up anything without a hashtag, which includes headings.

There has to be a way to do this with regex, right? Anything that starts with a hashtag and an alphanumeric character but not a space.

Anyone good with Regex that could help?

I’m not sure (I don’t use search a lot) but it seems that we are facing a false logic: how we search for “nothing” in regular search?
Can we search for nothing in google? In generic find?
You can do that with dataview plugin (because in that case it works with metadata).

Use this search:


It’s - (not), followed by a regex which is:

  • \s any whitespace character (including a newline character)
  • # a hash character
  • \w any alphanumeric character

So, find any note which doesn’t include a tag.


Amazing, thank you so much!

Thanks! AlanG has the solution. Essentially it’s ruling out any hashes that have a space or another hash, but do have an alphanumeric character after the hash


But in that case it exclude notes without tags but with a similar syntax inside code blocks?
For example: a note without tags but with a dataview query with the expression FROM #tag will be excluded.

1 Like

That’s true. I suppose I should add my needs and basics around my setup :

I’m looking for pages that fall through the cracks, eg - pages without tags and orphan pages. I’ve recently cleaned up and consistently used a taxonomy that covers the majority of my notes.

My playstyle is to use vanilla features as much as I can. Typically I use Dataview on my calendar-centric templates, where it’s good to have that info but not necessary to link everything together. If I use Dataview in another place the note is tagged so that I know.

In that case this regex seems to solve my needs well enough. It may not catch everything but it immensely helps me find untagged notes and to non-destructively improve my note system. A tool for a kit.


If you’re already using Dataview, then you can just use Dataview syntax to easily find any notes without tags, and avoid your codeblock issue or any other niche issues:

dv.pages().filter(x => !x.file.tags.length)

I know how to use Dataview to achieve that!
I only pointed to one low-accurate way to achieve that via search (and they’re not “niche issues”).

WHERE !file.tags

I found a solution that fit my needs, which I stated as “Finding files without tags via regex search.” This “solution” doesn’t meet that criteria and it’s off topic.

1 Like

My post was an answer to AlanG, not to “force” you to change your way.
My answer can be anything but for sure not an “off topic”.
This is a public Forum; you request a specific help; AlanG give you a solution…
But this is also a public discussion to others folks with a similar issue. Then, it’s natural that we can discuss the limits of the achieved solution and others alternatives… not for you, but for anyone interested in this topic.


Oh, so many wrong conclusions that I hesitated to answer! But here it goes.

1 - You request a very specific help.

2 - My first post start with an insecure step - “I’m not sure” -, not to discredit your request but to point to the difficult of the search by the “negation”: because it’s necessary to search by exclusion in the plain md text (the search works in raw text, not in the rendered one). And exclude all scenarios isn’t an easy task, mainly (I guess, because I’m a dumb in regex) because they’re other things using the “#” in similar way as tags but they’re not tags. I used the example of dataview code blocks, but I could point to others, like simple query blocks, etc.

3 - AlanG give you a great solution. It receives my “heart”.

4 - From here, I asked from some limitations, expecting, for example, for some kind of regex (an unknown territory for me) to exclude the “```” cases or anything inside inline code “`”.

5 - You answer me that for your case that isn’t an issue. At that moment I stopped my direct interaction with your case.

6 - But AlanG answer me calling that cases as “niche issues” and give me a dataview query to use, instead of the regex solution.

7 - I answered him saying that I know how to solve that using dataview (as an answer in dql to the dvjs query he gives me) and reply that I don’t consider this cases as “niche issues”.

8 - I repeat, that was a follow up of the Alan reply, not to you. Your case was solved.

9 - Then you came up saying that my «“solution” doesn’t meet that criteria and it’s off topic.»

10 - If clarifying possible issues is something “off topic” and a way to discredit the great Alan solution… well, they’re your conclusions about my interaction. As «Don’t yuck other people’s yum», don’t deduce and classify others intentions.

I don’t think you understand your behavior here and how off-putting it is. Please look at what you did again, and reflect how your actions push people away. (edit:) Take for example how you replied, once again, have told me anything I’ve said is wrong, and how your behavior is justified.


This is a friendly reminder about the forum guidelines:

You may wish to respond to something by disagreeing with it. That’s fine. But remember to criticize ideas, not people. Please avoid:

  • Name-calling
  • Ad hominem attacks
  • Responding to a post’s tone instead of its actual content
  • Knee-jerk contradiction

Instead, provide reasoned counter-arguments that improve the conversation.

Help us keep the community a space to freely ask questions and learn from one another! Please involve a moderator using existing tools:

When you see bad behavior, don’t reply. It encourages the bad behavior by acknowledging it, consumes your energy, and wastes everyone’s time. Just flag it .