No results when using (?-i) to search

A trivial search in the browser using re:(?-i)a is automatically changed to re: (?-i) a (note the inserted white space) and returns zero results. Any idea what’s going wrong? (Both the simple search a and re:a return many results, many of them matching the lower case.)

Fixed by putting quotes around the search string: "re:(?-i)a" works as expected. Possibly an old bug, sorry (I’m on Anki 2.1.54).

1 Like

It’s actually not a bug. Parentheses are special characters that delimit groups. If you want to include literal ones, e.g. to pass them into a regex, they need to be escaped.

It might have been more convenient to only treat parentheses as special characters at word boundaries, but now this is unlikely to change for compatibility reasons.