def _replace_expand(self, m, repl):
        if self.engine.isre():
            try:
                new = m.expand(repl)
            except re.error:
                self.engine.report_error(repl, 'Invalid Replace Expression')
                new = None
        else:
            new = repl
        return new
Helper function for expanding a regular expression
dataset/ETHPy150Open francelabs/datafari/windows/python/Lib/idlelib/ReplaceDialog.py/ReplaceDialog._replace_expand