From 694682d964a5d1e9b7c755f4d330bf79e293f810 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 16 Apr 2014 01:15:59 +0900 Subject: [PATCH] fix multiple cloze tags contained on one line inner regex was capturing multiple clozes. fixes https://anki.tenderapp.com/discussions/ankidesktop/6599-empty-cards-3533-cards-to-delete --- anki/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/anki/models.py b/anki/models.py index 599a10c92..5249ee128 100644 --- a/anki/models.py +++ b/anki/models.py @@ -569,7 +569,7 @@ select id from notes where mid = ?)""" % " ".join(map), sflds = splitFields(flds) map = self.fieldMap(m) ords = set() - matches = re.findall("{{[^}]*?cloze:(?:.*?:)*(.+?)}}", m['tmpls'][0]['qfmt']) + matches = re.findall("{{[^}]*?cloze:(?:[^}]?:)*(.+?)}}", m['tmpls'][0]['qfmt']) matches += re.findall("<%cloze:(.+?)%>", m['tmpls'][0]['qfmt']) for fname in matches: if fname not in map: