import re


def compile_ant_path(path: str) -> str:
    """
    Given a path, converts it to an ANT path regex
    :param path:
    :return:
    """
    star = r"[^\/]+"
    double_star = r".*"
    slash = r"\/"
    question_mark = r"\w"
    dot = r"\."
    # Apply transformation
    output = path.replace(r"/", slash).replace(r".", dot)
    output = re.sub(r"(?<!\*)\*(?!\*)", star, output)
    output = output.replace(r"**", double_star)
    output = output.replace(r"?", question_mark)
    return output