Search formatted blocks

So previously I have used a query to search in a page of all quoted blocks by the following query.

#+BEGIN_QUERY
{:title [:h3 “Comment in”]
:inputs [:current-page]
:query [:find (pull ?b [*])
:in $ ?cp
:where
[?p :block/name ?cp]
[?b :block/page ?p]
[?b :block/content ?c]
[(re-pattern “(>)”) ?regex]
[(re-find ?regex ?c)]]
}
#+END_QUERY

A problem came up. Scheduled date would pop up because it also has “>”
Is there a way I can exclude SCHEDULED DATE from this search.
I tried adding
(not [(re-pattern “(<)”) ?regex])
but it doesnt work.

It is strange that you search for single characters like > and <. Could you provide the markdown of:

  • example quoted blocks that should be included in the results
  • example scheduled dates that should be excluded from the results

I use “>” to make some comments in my page.
In the picture, the blue straight vertical line is the block that is searched and presented.
In the last block, the scheduled date is the one I don’t want. And I think it is because the <xxxx “>” that it was presented.

Try replacing "(>)" with "^>"

2 Likes

It worked. Thank you so much.

^ in regex means “match start”