Escape unsupported regex chars

This commit is contained in:
luoliyan 2017-02-22 18:24:03 +09:30
parent 12c98a21f0
commit dee0fe2880

View file

@ -141,8 +141,8 @@ class TagManager:
def remFromStr(self, deltags, tags): def remFromStr(self, deltags, tags):
"Delete tags if they exist." "Delete tags if they exist."
def wildcard(pat, str): def wildcard(pat, str):
return '*' in pat and re.search( pat = re.escape(pat).replace('\\*', '.*')
pat.replace('*', '.*'), str, re.IGNORECASE) return '*' in pat and re.search(pat, str, re.IGNORECASE)
currentTags = self.split(tags) currentTags = self.split(tags)
for tag in self.split(deltags): for tag in self.split(deltags):
# find tags, ignoring case # find tags, ignoring case