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

For example: I have several pages with the names (their filenames, not the property title) starting with “abc”. Is there a way to query all those pages?

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

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.

1 Like

it worked! thank you!