from re import search


def extract_substring(string: str, substring_left: str, substring_right: str, first_match: bool = True):
    if first_match:
        return search(f'{substring_left}(.*?){substring_right}', string).group(1)
    else:
        return search(f'{substring_left}(.*?){substring_right}', string)
