Reapply PR
@@ -1184,7 +1184,11 @@ class Linter(metaclass=LinterMeta):
if not match:
persist.debug('No match for regex: {}'.format(self.regex.pattern))
else:
- match_dict.update(match.groupdict())
+ match_dict.update({
+ k: v
+ for k, v in match.groupdict().items()
+ if k in match_dict
+ })
match_dict["match"] = match
# normalize line and col if necessary
