Potential bug with escape sequences on Regex

I’ve always had trouble with escaping quotations on my Regex searches but today I noticed a clue as to maybe why. If I escape only one or two special characters (“re:[”]" or “re:[”.]") I don’t seem to have a problem. However, if I try to escape more than two it gives me an error message and the popup window shows my search without the backslashes even though I put them in the search bar. Just wondering if this is a bug or if I don’t understand Regex well enough (which is also very possible).

I have these results on 2.1.35 and 2.1.41.

Thanks for the help!

Edit: Huh, even when I type them on this webpage, it doesn’t display them correctly. I guess something must be going on behind the scenes that I don’t understand. Here’s what I really typed for the portion above:

_ is only a special character in Anki. It must not be escaped in regex. So your search should be re:[\"\._]. You can read about the details here.
However, the formatting of the error message is broken: The carets should point to the erroneous characters and the backslashes aren’t printed out.
Coincidentally, the latter applies to your post for the same reason: Markdown consumes the backslashes, so you have either to escape them (type in two) or use preformatted text like I did in the first paragraph by wrapping it in backticks (`).


Sorry for the late reply but thanks for answering my question so quickly! I didn’t realize some characters shouldn’t be escaped in a Regex search but it’s good to know now. :grin:

Ah and thanks for the tip about using backticks. I’ll be sure to use those in future forum posts. :+1:

1 Like