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 Pavel
Recipients Pavel, docs@python
Date 2015-10-30.10:07:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1446199646.71.0.249231376897.issue25517@psf.upfronthosting.co.za>
In-reply-to
Content
The example advises ".*[.](?!bat$).*$" expression "to match filenames where the extension is not bat". But here is an example which passes such check:

>>> re.match("(.*)[.](?!bat$).*$", "test.a.bat")
<_sre.SRE_Match object at 0x7ff221996f30>

To my mind use of negative lookbehind expressions (not covered so far in the HOWTO) is better:

>>> re.match("(.*)[.].*(?<!.bat)$", "test.a.bat")
>>>
History
Date User Action Args
2015-10-30 10:07:26Pavelsetrecipients: + Pavel, docs@python
2015-10-30 10:07:26Pavelsetmessageid: <1446199646.71.0.249231376897.issue25517@psf.upfronthosting.co.za>
2015-10-30 10:07:26Pavellinkissue25517 messages
2015-10-30 10:07:26Pavelcreate