This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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 <>
'$' 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)
Date User Action Args
2012-10-12 19:45:41mrabarnettsetrecipients: + mrabarnett, gvanrossum, tim.peters, pitrou, serhiy.storchaka
2012-10-12 19:45:41mrabarnettsetmessageid: <>
2012-10-12 19:45:41mrabarnettlinkissue16203 messages
2012-10-12 19:45:41mrabarnettcreate