[extractor] Allow extracting multiple groups in _search_regex

From #497, Authored by: fstirlitz
This commit is contained in:
felix 2021-07-13 09:17:39 +02:00 committed by pukkandan
parent c888ffb95a
commit 198f7ea89e
No known key found for this signature in database
GPG key ID: 0F00D95A001F4698

View file

@ -1111,6 +1111,8 @@ def _search_regex(self, pattern, string, name, default=NO_DEFAULT, fatal=True, f
if group is None:
# return the first matching group
return next(g for g in mobj.groups() if g is not None)
elif isinstance(group, (list, tuple)):
return tuple(mobj.group(g) for g in group)
else:
return mobj.group(group)
elif default is not NO_DEFAULT: