def parse_search_string(string):
 criteria = {}
 for match in CRITERION_RX.finditer(string):
  field = (match.group('field') or '*')
  criteria[field] = match.group('pattern')
 return criteria

def parse_search_string ( string ) : criteria = { } for match in CRITERION_RX . finditer ( string ) : field = ( match . group ( 'field' ) or '*' ) criteria [ field ] = match . group ( 'pattern' ) return criteria
parses a search string! .