def _regex_process(string, replacement):
        """
        Replace matches from replacement.keys() in string to
            replacement.values()

        """
        re_mode = re.IGNORECASE
        escaped_keys = map(re.escape, replacement)
        pattern = re.compile("|".join(escaped_keys), re_mode)
        return pattern.sub(
            lambda match: replacement[match.group(0).lower()],
            string
        )

        Replace matches from replacement.keys() in string to
            replacement.values()

        
web_console_v2/api/fedlearner_webconsole/utils/kibana.py