Skip to content
Prev Previous commit
Next Next commit
Update glob to prefixmatch
  • Loading branch information
hugovk committed Apr 4, 2026
commit 8d0571ffd5f805b56b0154a4f95d8c43222a87b1
5 changes: 3 additions & 2 deletions Doc/library/glob.rst
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ The :mod:`!glob` module defines the following functions:
.. function:: translate(pathname, *, recursive=False, include_hidden=False, seps=None)

Convert the given path specification to a regular expression for use with
:func:`re.match`. The path specification can contain shell-style wildcards.
:func:`re.prefixmatch`. The path specification can contain shell-style
wildcards.

For example:

Expand All @@ -140,7 +141,7 @@ The :mod:`!glob` module defines the following functions:
>>> regex
'(?s:(?:.+/)?[^/]*\\.txt)\\z'
>>> reobj = re.compile(regex)
>>> reobj.match('foo/bar/baz.txt')
>>> reobj.prefixmatch('foo/bar/baz.txt')
<re.Match object; span=(0, 15), match='foo/bar/baz.txt'>

Path separators and segments are meaningful to this function, unlike
Expand Down