Search all To-Does

Hi, can’t find if there is query to Search To-Does ( - [ ]) in my Vault?
I want to find all To-Does (or maybe some of them)…Is it possible to do this by Searching ( - [ ] is not working sadly) ? Thanks very much!

“- [ ]” should work, though you can also do some fancy regex to include both complete and not complete.

1 Like

This search works for me to find all my unfinished todos:

/- \[ \].*/

7 Likes
  • [ ] Doesn’t work , i have wrote it in 1st message

Thank you very much! But how about finished tasks?

Include the quotes: ”- [ ]”. You wrote - [ ].

For finished tasks, it’s almost the same but with an ‘x’:

/- \[x\].*/

1 Like

The regex really isn’t necessary, is it? “- [ ]” and “- [x]” work the same, and are more readable.

The only reason to use Regex would be a search like - \[[x\s]\].* to get both completed and not-completed items. Or am I missing something?

1 Like

Sure, both approaches work for finding open tasks.

The reason I prefer using the regex I posted above is that it selects the entire line, not just the checkbox. So in my search results, the full text of each todo item is highlighted in yellow. I find that a lot easier to scan when reviewing my tasks.

image

7 Likes

wow - Super Great! :+1:

With quotes not working


Regex works great!

1 Like

The cause is Discourse.

Sorry Discourse editor (ie this forum) actually twisted @ryanjamurphy’s into another variant of quotes, on saving.

You should type the quotes using keyboard in Obsidian Search. Do not copy paste from this forum.

3 Likes

do you have a space between ?

@Craig ahh, right, the full highlighting is nice. Thanks for the follow-up!

@Kiroro Hah great catch. I was so confused.

1 Like

You are right about another variant of quotes - it makes sense! Thank you , now its working!

1 Like

is there a way to search for todos under a specific heading?

A query like (section:("## actions") task:"") will return all tasks in a section with the heading “## Actions”. It’ll also return the heading itself as a result, but I don’t think there’s a way to avoid that.

The Search help might be useful:
https://help.obsidian.md/Plugins/Search

1 Like