From bdcc8e284b8db4f7f38071d4155dabb3726aa414 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 8 Sep 2017 15:13:46 +1000 Subject: [PATCH] re.escape() deck search --- anki/find.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/anki/find.py b/anki/find.py index 214f11644..6ae6776ce 100644 --- a/anki/find.py +++ b/anki/find.py @@ -394,9 +394,7 @@ select distinct(n.id) from cards c, notes n where c.nid=n.id and """+preds else: # wildcard ids = set() - # should use re.escape in the future - val = val.replace("*", ".*") - val = val.replace("+", "\\+") + val = re.escape(val).replace(r"\*", ".*") for d in self.col.decks.all(): if re.match("(?i)"+val, d['name']): ids.update(dids(d['id']))