Message253725
| 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: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 |
|