import re


def __modify_name_remove(file_name, string, position):
    """
        Core method to remove a string from the base name of a file.
    """
    file_newname = ""

    if position == "any":
        file_newname = file_name.replace(string, "")
    elif position == "prefix":
        file_newname = re.sub("^" + string, "", file_name)
    elif position == "suffix":
        file_newname = re.sub(string + "$", "", file_name)

    return file_newname