How to search for cards containing quotes

If I have a card where the “front” field is This text contains a "quote", how do I do an exact search for this in the card browser? Doing front:"This text contains a "quote"" doesn’t work, and I can’t seem to find any escape character like backslash to make it work.


Have your tried using single quotes instead?

Yes, front:'This text contains a "quote"' doesn’t match anything.

Interesting. I just did some tests on my end and found that,

Title:"This is a \"quote\"" fails

"Title:This is a \"quote\"" works

So the escaping works but only when the entire term in enclosed in quotes. Definitely a bug.


Ah, thanks for the workaround! Hope the bug gets fixed to avoid confusion, and it would also be nice for escaping to be documented on the site.

I think it is somewhere in the manual. That’s how I know about it! Either that or from reddit.

So I’m trying different edge cases, and I’m having issues searching for text that contains the \" characters. For example, if my card has the front text This text contains a \"slash and quote", searching "front:This text contains a \\"slash and quote\"" doesn’t work, and even escaping the slash doesn’t work, like "front:This text contains a \\\"slash and quote\"".

Good job on finding that! Although I am wondering what evil energies would compel you/anyone to use \" in a field unless they are entering programming code in there? Also, the search supports regular expressions and wild chars so that could be helpful workarounds for such cases too.

I was just experimenting with the escape character to understand it better, but programming was the main motivation (I’m experimenting with how search works in the desktop app for future use in an add-on, so I need to understand these edge cases because other people might have this in their cards).

I’ll see if I can get regex to handle this more robustly, but what’s the official way to report a bug like this to the devs?

1 Like

Anki is developed by just one Dev @dae ! The forums here are new and I don’t see a bug reports category. Perhaps @dae can shed some light on this.

Thanks for the report, I’ll have a fix in the next build.

1 Like

FYI, in version 2.1.15, I’m able to use single quotes around field names to search on fields, but it doesn’t work in 2.1.30 (current) or 2.1.26 (previous stable release).