Is it possible to use wildcards in queries?

The use case would be to find pages that start with a certain text.

For example, all pages that start with “task.myName.”.
Something like {{query [[task.myName.*]] }} or can this be done with an advanced query?

Thanks for your help.

2 Likes

Since you said start with, one way to do this below. You can replace starts-with with includes or ends-with.

#+BEGIN_QUERY
{:query [:find (pull ?b [*])
         :in $ ?s
         :where
         [?b :block/original-name ?n]
         [(clojure.string/starts-with? ?n ?s)]]
 :inputs [ "task.myName." ]
 }
#+END_QUERY

If you want to use wildcards, you need to use regex, check out Bailey Jennings’ search query here. If you need further assistance, just tell.

7 Likes

That was quick and helped me a lot.
Thanks :slightly_smiling_face:

@c6p Thanks again for the solution.

What I noticed is that the result is only shown in table form and there is no button to switch to block view.
Is there something about the query that causes that or is this a bug or something else?

Thanks

It was asked a few days ago and here is tienson’s answer. For now page queries shown in table view.

1 Like