regex scanner groups findall tuple bug fixed

This commit is contained in:
sohyeonhwang
2019-12-12 07:47:07 -06:00
parent 097c60a7bc
commit 950ed8fde9
2 changed files with 13 additions and 2 deletions

12
wikiq
View File

@@ -189,7 +189,17 @@ class RegexPair(object):
#given that there are matches to be made
if self.pattern.search(content) is not None:
m = self.pattern.findall(content)
temp_dict[self.label] = ', '.join(m)
m_fixed = []
for match in m:
if type(match) is tuple:
matchies = set()
for sub_m in match:
matchies.add(sub_m)
m_fixed += matchies
else:
m_fixed.append(match)
temp_dict[self.label] = ', '.join(m_fixed)
else:
temp_dict[self.label] = None