Case sensitivity in Anki is a mess. I would like a simple way to enable or disable case-sensitivity in search queries.
We already have ‘keywords’ like re: (regex), w: (whole word) and nc: (no combining). So I suggest the following:
- Add the keywords
ci:(case-insensitive) andcs:(case-sensitive). They will use the Unicode properties for casing. - Allow these keywords to be combined with other keywords in a search term. And while we’re at it, allow all tags to be combined, as long as they don’t contradict each other.
Examples of search queries:
ci:schwill matchschijnheilig,NederlandscheandSchiphol.cs:Schwill matchSchiphol, but notschijnheiligorNederlandsche.front:cs:w:Applewill matchApplein aFrontfield, but notapple,APPLEorApples.w:nc:hewill matchhe,Héandhè, but nothemelorNähe.ci:nc:w:ἀμήνwill matchἀμήνandἈμὴν.cs:W*?will matchWhat time is it?andWhere?, but notwhy?orwould you?.cs:nc:ander_will matchändern,andere,anders, but notAndersorander.ci:re:[jt]iwill matchJi,Ti,ji,TI, etc.
To make this work, we will have to require an order on the keywords. re: must in any case be the last one. That is, everything after re: will be interpreted as part of the regex. Otherwise you might run into issues with the query "re:ci: a" – is this the case-sensitive regex ci: a or the case-insensitive regex a?
Combining ci: and cs: in one search term will raise an error, just like using lookaheads and lookbehinds in a regex currently does.
One tiny disadvantage is that searching on fields named ci or cs becomes impossible, as this is currently if you name a field deck for instance. But I think the user should just be warned that they won’t be able to search on that field if they want to name a field after a keyword like w, nc, etc.