import re


def select_from_format(regex, iban_format: str, iban: str) -> str:
    """
    Selects part of an IBAN string using regex

    Use to extract info from IBAN such as country code, bank code and others

    :param regex: the regex
    :type regex: str/r
    :param iban_format: the iban format string used to locate the info position
    :type iban_format: str
    :param iban: The iban
    :type iban: str
    :return: a string representing the part of the iban
    :rtype: str
    """
    match = re.search(regex, iban_format)
    if match:
        start = match.start()
        end = match.end()
        return iban[start:end]
    else:
        return ""