Full-text case-insensitive regex

Is it possible to ignore case sensitive string queries? Say I have the multiple nodes with “Climate Trace”, “Climate TRACE”, “climatetrace”. How do I write the correct query to make sure I don’t miss any nodes? Is there regex capability?

{{query “climate trace”}}

1 Like

Advanced queries support regex.
Here’s the query for you:

#+BEGIN_QUERY
{:title "Climate Trace"
:query
[:find (pull ?b [*])
:in $ ?input
:where
[(str "(?i)" ?input) ?pattern]
[?b :block/content ?c]
[(re-pattern ?pattern) ?q]
[(re-find ?q ?c)]]
:inputs ["climate trace"]
}
#+END_QUERY
4 Likes

I was using {{query "term"}} but that is case sensitive, so I was open a question here to ask for a case-agnostic solution. Discourse suggested this page, which is exactly what I was looking for.
Thank you :pray:

1 Like

this query no longer works. Has the query syntax changed in Logseq? Could someone send an updated query that works in the current version of Logseq? thanks

Sorry, it actually does work. When I pasted into Logseq, it added an asterisk (*) at the beginning and end of the first and last line. Once I removed those, it works.

Note for other query newbies like me that you can set the title to anything (such as “Search - not case sensitive”). You don’t need to enter your search item twice in the query every time you change to a new search item. You just need to update the inputs line.