def match_list(lst, pattern, group_names=[]):
filtfn = re.compile(pattern).match<EOL>filtlst = filter_list(lst, filtfn)<EOL>if not group_names:<EOL><INDENT>return [m.string for m in filtlst]<EOL><DEDENT>else:<EOL><INDENT>return [m.group(group_names) for m in filtlst]<EOL><DEDENT>
Parameters
----------
lst: list of str

regex: string

group_names: list of strings
    See re.MatchObject group docstring

Returns
-------
list of strings
    Filtered list, with the strings that match the pattern