def ReplaceAll(pattern, rep, s):
 if (pattern not in _regexp_compile_cache):
  _regexp_compile_cache[pattern] = sre_compile.compile(pattern)
 return _regexp_compile_cache[pattern].sub(rep, s)

def ReplaceAll ( pattern , rep , s ) : if ( pattern not in _regexp_compile_cache ) : _regexp_compile_cache [ pattern ] = sre_compile . compile ( pattern ) return _regexp_compile_cache [ pattern ] . sub ( rep , s )
replaces instances of pattern in a string with a replacement .