matching multiple regexs to a single line...
John Hunter
jdhunter at nitace.bsd.uchicago.edu
Tue Nov 12 16:18:01 EST 2002
>>>>> "Alexander" == Alexander Sendzimir <lists at battleface.com> writes:
Alexander> To do this in Python and be able to get at the match if a
Alexander> regex succeeds means I have to break up the if's because
That's what I usually end up doing
for line in myfile:
m = r1.match(line)
if m:
do_something()
break
m = r2.match(line)
if m:
do_something_else()
break
John Hunter
More information about the Python-list
mailing list