import re


def escapeRegex(text):
    """
    Escape string to use it in a regular expression:
    prefix special characters « ^.+*?{}[]|()\$ » by an antislash.
    """
    return re.sub(r"([][^.+*?{}|()\\$])", r"\\\1", text)