From 320cf05a517df9a2e121f828343a8a73de9a7f52 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 6 Nov 2012 08:37:38 +0900 Subject: [PATCH] escape () in field search --- anki/find.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/anki/find.py b/anki/find.py index c35af4c6a..e3f4e5a5f 100644 --- a/anki/find.py +++ b/anki/find.py @@ -406,7 +406,7 @@ select distinct(n.id) from cards c, notes n where c.nid=n.id and """+preds # nothing has that field return # gather nids - regex = val.replace("_", ".").replace("%", ".*") + regex = re.escape(val).replace("\\_", ".").replace("\\%", ".*") nids = [] for (id,mid,flds) in self.col.db.execute(""" select id, mid, flds from notes