import re


def getDatefromName(fname):
    """
    Returns the date of the form YYYY-MM-DD from fname, or an empty
    string if there is no string that matches. If there are multiple
    matches, this returns the first of them.
    """
    dates = re.findall(r"\d{4}-\d{2}-\d{2}", fname)
    if len(dates) == 0:
        return ''
    else:
        return(dates[1])