import re


def findfirst(pattern, string, flags=0):
    """Return the first string of a regular expression match or an empty
    string if no result was found."""
    string_list = re.search(pattern, string, flags)
    if string_list:
        result = string_list.group(0)
    else:
        result = ""
    return result