Author mrabarnett
Recipients gvanrossum, mrabarnett, pitrou, serhiy.storchaka, tim.peters
Date 2012-10-12.19:45:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1350071141.83.0.637701466962.issue16203@psf.upfronthosting.co.za>
In-reply-to
Content
'$' will match at the end of the string or just before the final '\n':

>>> re.match(r'abc$', 'abc\n')
<_sre.SRE_Match object at 0x00F15448>

So shouldn't you be using r'\Z' instead?

>>> re.match(r'abc\Z', 'abc')
<_sre.SRE_Match object at 0x00F15410>
>>> re.match(r'abc\Z', 'abc\n')
>>> 

And what happens if the MULTILINE flag is turned on?

>>> re.match(r'abc$', 'abc\ndef', flags=re.MULTILINE)
<_sre.SRE_Match object at 0x00F15448>
>>> re.match(r'abc\Z', 'abc\ndef', flags=re.MULTILINE)
>>>
History
Date User Action Args
2012-10-12 19:45:41mrabarnettsetrecipients: + mrabarnett, gvanrossum, tim.peters, pitrou, serhiy.storchaka
2012-10-12 19:45:41mrabarnettsetmessageid: <1350071141.83.0.637701466962.issue16203@psf.upfronthosting.co.za>
2012-10-12 19:45:41mrabarnettlinkissue16203 messages
2012-10-12 19:45:41mrabarnettcreate