Why no match?
Robin Becker
robin at jessikat.fsnet.co.uk
Mon Dec 17 06:53:55 EST 2001
I'm puzzled as to why the second of these pattern matches fails. They
only differ in that the second is supposed to match to the end of line.
Can any regexpert supply an answer?
>>> import re
>>> re.compile(r'^self\s*\.\s*test\s*=\s*\d\s*').match('self.test=11')
<SRE_Match object at 010711F8>
>>> re.compile(r'^self\s*\.\s*test\s*=\s*\d\s*$').match('self.test=11')
>>>
--
Robin Becker
More information about the Python-list
mailing list