import re


def changeFileNoInFilePath(path: str, fileNo: int) -> str:
    """replaces the number in the path with the given number."""

    separator = r"[0-9]+\."
    splitted_path = re.split(separator, path, 1)
    new_path = splitted_path[0] + str(fileNo) + "." + splitted_path[1]
    return new_path