baiwj
1
hi,
I want to query a keyword in all blocks, the keyword would look like “book.”, “book,”, “book<” i.e. it followed by signs.
I tried follow code, but not working …
#+BEGIN_QUERY
{:title [:h3 "query for keywords"]
:query [:find (pull ?b [*])
:where
[?b :block/content ?text]
(or
[(clojure.string/includes? ?text "book[.,<]")]
)]}
#+END_QUERY
pls help how to make it in regex?
thank you
1 Like
There are many regex examples in the forum (e.g. this one). They use re-pattern
and re-find
.
baiwj
4
hi mentaloid,
thank you for your reference, after some tryings, the code below is working for my purpose:
#+BEGIN_QUERY
{:title [:h3 "query for keywords"]
:query [:find (pull ?b [*])
:where
[(str "book[.,<]") ?regexp]
[(re-pattern ?regexp) ?pattern]
[?b :block/content ?content]
[(re-find ?pattern ?content)]
]}
#+END_QUERY
2 Likes