import re


def parser_regex(regex, group, ignorecase=False):
    """
    Recovers the group from a regex and returns it
    :param regex: regex
    :param group: the group to recover
    :param ignorecase: False by default
    :return: the group obtained.
    """
    if ignorecase:
        return lambda x: re.search(regex, x, re.I).groups()[group]
    return lambda x: re.search(regex, x).groups()[group]