def match_subgroup(sequence, pattern):
    """Yield the sub-group element dictionary that match a regex pattern."""

    for element in sequence:
        match = re.match(pattern, element)

        if match:
            yield match.groupdict()
def match_subgroup ( sequence , pattern ) : for element in sequence : match = re . match ( pattern , element ) if match : yield match . groupdict ( )
Yield the sub-group element dictionary that match a regex pattern.