import re


def replace_all(src_string, regex, replacement):
    """
    Replace each occurrence of regular expression match in
    the first string with the replacement string and return the
    replaced string. A 'regex' string with null value is considered as
    no change. A 'replacement' string with null value is consider as an empty string.
    """
    if not regex:
        return src_string
    if not replacement:
        replacement = ""
    return re.sub(regex, replacement, src_string)