def re_collect_groups(re_match, groups=[], repl=''):
    """
    Collect groups for re.sub
    :param re_match: re match object
    :param groups: a list used to return the groups matched
    :param repl: replacement string
    :return: repl string
    """
    groups.extend(re_match.groups())
    return repl