R. David Murray added the comment:
Thanks Christophe and Merlijn.
--
nosy: +r.david.murray
resolution: - fixed
stage: - resolved
status: open - closed
versions: +Python 2.7, Python 3.5
___
Python tracker rep...@bugs.python.org
Roundup Robot added the comment:
New changeset c5c65ef84a77 by R David Murray in branch '3.4':
#24108: Update fnmatch.translate example to show correct output.
https://hg.python.org/cpython/rev/c5c65ef84a77
New changeset cc6aed8ecb0d by R David Murray in branch 'default':
Merge: #24108: Update
Merlijn van Deen added the comment:
As far as I can see, the regex is correct:
\Z
Matches only at the end of the string.
(?iLmsux)
The group matches the empty string; the letters set the corresponding flags:
(...)
- re.M (multi-line),
- re.S (dot matches all)
See
Christophe BAL added the comment:
Ok.
But in that case, the official documentation should be updated because it
saids that string regex is *'.*\\.txt\\Z(?ms)'* and not *'.*\\.txt$'*.
On the other hand, using this writing seems a bit strange. The 2nd one
should do the job.
*Christophe BAL*
New submission from Christophe BAL:
Hello.
I find the following bug on Python 3.4.
import fnmatch, re
regex = fnmatch.translate('*.txt')
regex
'.*\\.txt\\Z(?ms)'
The string regex should be '.*\\.txt$'.
--
components: asyncio
messages: 242346
nosy: gvanrossum, haypo, projetmbc,
Changes by Yury Selivanov yseliva...@gmail.com:
--
nosy: -yselivanov
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24108
___
___
Python-bugs-list
Merlijn van Deen added the comment:
They are subtly different; the new regex also matches filenames with newlines,
the old one doesn't (see Issue #6665 [1]).
Patch (although crazily minor) attached. With some fuzz, it applies on
everything from 2.6..default.
[1]
Christophe BAL added the comment:
Oups, sorry I want to say that you are totally RIGHT, and I am definitely
WRONG. :-)
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24108
___
Changes by Guido van Rossum gu...@python.org:
--
nosy: -gvanrossum
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24108
___
___
Python-bugs-list
Christophe BAL added the comment:
You're totally wrong and I am wrong.
There is still the tiny problem of the documentation.
Thanks for all.
*Christophe BAL*
*Enseignant de mathématiques en Lycée **et développeur Python amateur*
*---*
*French math teacher in a Lycée **and **Python **amateur
10 matches
Mail list logo