How to query pages that have names start with a certain set of characters?

#+BEGIN_QUERY
{:title "Pages that start with abc"
 :query [:find (pull ?p [*])
         :where 
         [?p :block/name ?name]
         [(clojure.string/starts-with? ?name "abc")]]
}
#+END_QUERY

Note that the :block/name will always have the page names stored in small case, i.e., you will also get pages named with ABC, aBc, etc., in this query.

If you want only the pages starting with abc, then replace the :block/name with :block/original-name.

3 Likes