From 311897a393d5eb4b54fce50d3d23759ec8e72655 Mon Sep 17 00:00:00 2001 From: ospalh Date: Fri, 4 May 2012 12:13:47 +0200 Subject: [PATCH] match the whole {{xx:yy]] field so we can delete it --- anki/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/anki/models.py b/anki/models.py index 6beea1b05..034a9f01f 100644 --- a/anki/models.py +++ b/anki/models.py @@ -264,10 +264,10 @@ select id from cards where nid in (select id from notes where mid = ?)""", def renameField(self, m, field, newName): self.col.modSchema() - pat = "({{|[:#^/])%s(}})" + pat = r'{{([:#^/]|[^:#/^}][^:}]*?:|)%s}}' def wrap(txt): def repl(match): - return match.group(1) + txt + match.group(2) + return '{{' + match.group(1) + txt + '}}' return repl for t in m['tmpls']: for fmt in ('qfmt', 'afmt'):