import re


def get_mod_name_from_url(url: str) -> str:
    """Extracts the file name from the url.

    Args:
        url: url of a downloaded file

    Returns:
        str: name of the file name

    Examples:
        >>> FileDownloader._get_mod_name_from_url(("https://files.nexus-cdn.com/110/3863/"
        >>> "SkyUI_5_1-3863-5-1.7z?md5=5yKmT54-6qBhgCjAYwUuxg&expires=1552787172&"
        >>> "user_id=522107&rip=31.183.199.94"))
        SkyUI_5_1-3863-5-1.7z
    """
    # Splitting the url into parts on '/' and getting the last part containing the file name
    last_part = url.split(sep="/")[-1]

    # Regex search for the file name
    pattern = r"^.+(?=\?)"
    regex = re.compile(pattern=pattern)
    match = re.match(regex, last_part)
    if match:
        file_name = match[0]
    else:
        raise ValueError(("Could not find the file name in"
                          " the last part of the url {}.").format(last_part))
    return file_name