Hi I have a list of regular expression patterns like such: thelist = ['^594694.*','^689.*','^241.*','^241(0[3-9]|1[0145]|2[0-9]|3[0-9]|41|5[1-37]|6[138]|75|8[014579]).*']
Now I want to iterate thru each of these like: for pattern in thelist: regex=re.compile(pattern) if regex.match('24110'): the_pattern = pattern . . sys.exit(0) but in this case it will pick thelist[2] and not the list[3] as I wanted to, how can I have it pick the pattern that describes it better from the list. Thanks for your help and advice in advance, Shidan _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor