mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
gh-133306: Use \z instead of \Z in fnmatch.translate() and glob.translate() (GH-133338)
This commit is contained in:
parent
cb3174113e
commit
add0ca9ea0
7 changed files with 96 additions and 94 deletions
|
@ -111,7 +111,7 @@ functions: :func:`fnmatch`, :func:`fnmatchcase`, :func:`.filter`.
|
|||
>>>
|
||||
>>> regex = fnmatch.translate('*.txt')
|
||||
>>> regex
|
||||
'(?s:.*\\.txt)\\Z'
|
||||
'(?s:.*\\.txt)\\z'
|
||||
>>> reobj = re.compile(regex)
|
||||
>>> reobj.match('foobar.txt')
|
||||
<re.Match object; span=(0, 10), match='foobar.txt'>
|
||||
|
|
|
@ -134,7 +134,7 @@ The :mod:`glob` module defines the following functions:
|
|||
>>>
|
||||
>>> regex = glob.translate('**/*.txt', recursive=True, include_hidden=True)
|
||||
>>> regex
|
||||
'(?s:(?:.+/)?[^/]*\\.txt)\\Z'
|
||||
'(?s:(?:.+/)?[^/]*\\.txt)\\z'
|
||||
>>> reobj = re.compile(regex)
|
||||
>>> reobj.match('foo/bar/baz.txt')
|
||||
<re.Match object; span=(0, 15), match='foo/bar/baz.txt'>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue