import re


def replace_multiple_strings_one_pass(s, repDict):
    """
    Replace multiple strings in **one pass**, taking as argument a dictionary of {'old_text':'new_text'}.

    Note that the replacement is made in one pass, such that we avoid problems of unwanted
    replacements due to iterative modification of the string, such as:
    "spamham sha".replace("spam", "eggs").replace("sha","md5") being "eggmd5m md5" instead of "eggsham md5"

    See https://stackoverflow.com/questions/6116978/how-to-replace-multiple-substrings-of-a-string
    """
    pattern = re.compile("|".join([re.escape(k) for k in repDict.keys()]))
    return pattern.sub(lambda match: repDict[match.group(0)], s)