未验证 提交 198f7ea8 编写于 作者: F felix 提交者: pukkandan

[extractor] Allow extracting multiple groups in `_search_regex`

From #497, Authored by: fstirlitz
上级 c888ffb9
......@@ -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:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册