#NEWLINE# def build_regex( self ) : #NEWLINE# #INDENT# input_pattern_parts = self . input_pattern . split ( '.' ) #NEWLINE# regex_pattern_parts = [ ] #NEWLINE# for input_part in input_pattern_parts : #NEWLINE# #INDENT# if ( ( '<<' in input_part ) and ( '>>' in input_part ) ) : #NEWLINE# #INDENT# i = input_part . find ( '<<' ) #NEWLINE# j = input_part . find ( '>>' ) #NEWLINE# pre = input_part [ : i ] #NEWLINE# post = input_part [ ( j + 2 ) : ] #NEWLINE# field_name = input_part [ ( i + 2 ) : j ] #NEWLINE# regex_part = ( '%s(?P<%s>.+)%s' % ( pre , field_name , post ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# i = input_part . find ( '<' ) #NEWLINE# j = input_part . find ( '>' ) #NEWLINE# if ( ( i > ( - 1 ) ) and ( j > i ) ) : #NEWLINE# #INDENT# pre = input_part [ : i ] #NEWLINE# post = input_part [ ( j + 1 ) : ] #NEWLINE# field_name = input_part [ ( i + 1 ) : j ] #NEWLINE# regex_part = ( '%s(?P<%s>[^.]+)%s' % ( pre , field_name , post ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( input_part == '*' ) : #NEWLINE# #INDENT# regex_part = '[^.]+' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# regex_part = input_part . replace ( '*' , '[^.]*' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# regex_pattern_parts . append ( regex_part ) #NEWLINE# #UNINDENT# regex_pattern = ( '\\.' . join ( regex_pattern_parts ) + '$' ) #NEWLINE# self . regex = re . compile ( regex_pattern )