regex's

chibaA at TinterlogD.Tcom chibaA at TinterlogD.Tcom
Tue Jul 4 20:24:41 EDT 2000


Hi...  I'm having a bit of a brain-tease...  I have the following code
(example):

import re

str = '123'
if re.compile('1').match(str):
	print "matched 1"
if re.compile('2').match(str):
	print "matched 2"
if re.compile('3').match(str):
	print "matched 3"

-------------------

I would think that this code would print 'matched 1 matched 2 matched
3'...  But in this case, it would only printed "matched 1".  Any
reasons?  Is there any way to have it print all three (since the
conditions seem to be true)?

Thanks in advance!

kc.



More information about the Python-list mailing list