#NEWLINE# def remove_rules_regex( self , regex ) : #NEWLINE# #INDENT# 'Remove all rules matching regex.' #NEWLINE# if isinstance ( regex , six . string_types ) : #NEWLINE# #INDENT# regex = re . compile ( self ) #NEWLINE# #UNINDENT# num_rules = len ( self . rules ) #NEWLINE# self . rules = [ r for r in self . rules if ( not regex . match ( str ( r ) ) ) ] #NEWLINE# removed = ( num_rules - len ( self . rules ) ) #NEWLINE# if ( removed > 0 ) : #NEWLINE# #INDENT# self . dirty = True #NEWLINE# #UNINDENT# return removed