Option to ignore {{c1::}} on literal searches

I have pieces of laws in my notes, and I apply clozes to in them. For example:

Lorem {{c1::ipsum dolor}} sit amet, consectetur adipiscing elit.

Sometimes, I want to search all my notes that contain a certain piece of law. So, I do a search like this: “Lorem ipsum”.

The problem is that, if I applied a cloze to it, like in the example above, the note won’t be found.

So, I would like to have the option to ignore clozes markup when doing literal search.

I even dare to say that this should be the default behavior, because it’s very rare that the user will make the search including a piece of cloze markup, like “Lorem {{c1::ipsum”.

Thanks,

5 Likes

I think you can search by putting regular expression ([{{c\d::}}\s]*?) between each characters.

  • String you want to search
Lorem ipsum dolor
  • Target strings
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Lorem ipsum {{c1::dolor}} sit amet, consectetur adipiscing elit.
Lorem ipsum dolor {{c3::sit amet,}} consectetur adipiscing elit.
Lorem{{c7:: ipsum}} dolor sit amet, consectetur adipiscing elit.
{{c9::Lorem}}ipsum dolor sit amet, consectetur adipiscing elit.
  • regular expression
([{{c\d::}}\s]*?)
  • Anki’s regular expression
"re:text"
  • Search string
"re:Lorem([{{c\d::}}\s]*?)ipsum([{{c\d::}}\s]*?)dolor"

Interesting. Thanks!

1 Like