Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Doc/library/pathlib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,16 @@ Pure paths provide the following methods and properties:
>>> PurePath('/a/b/c.py').full_match('**/*.py')
True

A pattern ending in "``/**``" needs the separator before it to be present
in the path, even though "``**``" can match zero segments. For instance,
"``/a/**``" matches "``/a/b``" but not "``/a``", and since :class:`PurePath`
drops trailing slashes, it does not match "``/a/``" either::

>>> PurePath('/a/b').full_match('/a/**')
True
>>> PurePath('/a').full_match('/a/**')
False

.. seealso::
:ref:`pathlib-pattern-language` documentation.

Expand Down Expand Up @@ -1796,6 +1806,8 @@ The following wildcards are supported in patterns for

``**`` (entire segment)
Matches any number of file or directory segments, including zero.
Note that in :meth:`~PurePath.full_match`, "``a/**``" does not match
"``a``", whereas :meth:`~Path.glob` yields "``a``" for that pattern.
``*`` (entire segment)
Matches one file or directory segment.
``*`` (part of a segment)
Expand Down
Loading