#NEWLINE# def apply_replace( self , s ) : #NEWLINE# #INDENT# if ( ( not self . matchreplacecheck ) or ( not self . matchedit ) ) : #NEWLINE# #INDENT# return s #NEWLINE# #UNINDENT# if ( not self . regex ) : #NEWLINE# #INDENT# matchpat = fnmatch . translate ( self . matchedit ) #NEWLINE# replacepat = helpers . translate ( self . replaceedit ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# matchpat = self . matchedit #NEWLINE# replacepat = self . replaceedit #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# s = re . sub ( matchpat , replacepat , s , flags = self . ignorecase ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# return s