Message253725
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")
>>> |
|
Date |
User |
Action |
Args |
2015-10-30 10:07:26 | Pavel | set | recipients:
+ Pavel, docs@python |
2015-10-30 10:07:26 | Pavel | set | messageid: <1446199646.71.0.249231376897.issue25517@psf.upfronthosting.co.za> |
2015-10-30 10:07:26 | Pavel | link | issue25517 messages |
2015-10-30 10:07:26 | Pavel | create | |
|