New submission from Pavel: 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")
---------- assignee: docs@python components: Documentation messages: 253725 nosy: Pavel, docs@python priority: normal severity: normal status: open title: regex howto example in "Lookahead Assertions" type: behavior versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue25517> _______________________________________