#NEWLINE# def __main__( ) : #NEWLINE# #INDENT# parser = optparse . OptionParser ( ) #NEWLINE# parser . add_option ( '-m' , '--multiline' , action = 'store_true' , dest = 'multiline' , default = False , help = 'Use Multiline Matching' ) #NEWLINE# ( options , args ) = parser . parse_args ( ) #NEWLINE# input = open ( args [ 0 ] , 'rb' ) #NEWLINE# if ( len ( args ) > 1 ) : #NEWLINE# #INDENT# output = open ( args [ 1 ] , 'wb' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if options . multiline : #NEWLINE# #INDENT# suffix = 're_match_multiline' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# suffix = 're_match' #NEWLINE# #UNINDENT# output = open ( ( '%s.%s' % ( args [ 0 ] , suffix ) ) , 'wb' ) #NEWLINE# #UNINDENT# if options . multiline : #NEWLINE# #INDENT# lines = [ re . escape ( input . read ( ) ) ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# lines = [ ( '%s\n' % re . escape ( line . rstrip ( '\n\r' ) ) ) for line in input ] #NEWLINE# #UNINDENT# output . writelines ( lines ) #NEWLINE# output . close ( )