@@ -546,8 +546,10 @@ Pure paths provide the following methods and properties:
546
546
547
547
.. method :: PurePath.match(pattern)
548
548
549
- Match this path against the provided glob-style pattern. Return ``True ``
550
- if matching is successful, ``False `` otherwise.
549
+ Match this path against the provided glob-style pattern. The pattern uses
550
+ the same format as in :func: `Path.glob `, except that "``** ``" wildcards
551
+ behaves just like "``* ``". Return ``True `` if matching is successful,
552
+ ``False `` otherwise.
551
553
552
554
If *pattern * is relative, the path can be either relative or absolute,
553
555
and matching is done from the right::
@@ -574,7 +576,6 @@ Pure paths provide the following methods and properties:
574
576
>>> PureWindowsPath('b.py').match('*.PY')
575
577
True
576
578
577
-
578
579
.. method :: PurePath.relative_to(other, walk_up=False)
579
580
580
581
Compute a version of this path relative to the path represented by
@@ -861,7 +862,7 @@ call fails (for example because the path doesn't exist).
861
862
>>> sorted(Path('.').glob('*/*.py'))
862
863
[PosixPath('docs/conf.py')]
863
864
864
- Patterns are the same as for :mod: `fnmatch `, with the addition of "``** ``"
865
+ Pattern segments are the same as for :mod: `fnmatch `, with the addition of "``** ``"
865
866
which means "this directory and all subdirectories, recursively". In other
866
867
words, it enables recursive globbing::
867
868
@@ -872,6 +873,22 @@ call fails (for example because the path doesn't exist).
872
873
PosixPath('setup.py'),
873
874
PosixPath('test_pathlib.py')]
874
875
876
+ The following wildcards are available:
877
+
878
+ +------------+----------------------------------------------------------+
879
+ | Pattern | Meaning |
880
+ +============+==========================================================+
881
+ | ``** `` | matches any number of nested directories |
882
+ +------------+----------------------------------------------------------+
883
+ | ``* `` | matches any part of a file or directory name |
884
+ +------------+----------------------------------------------------------+
885
+ | ``? `` | matches any single character in a file or directory name |
886
+ +------------+----------------------------------------------------------+
887
+ | ``[seq] `` | matches any character in seq |
888
+ +------------+----------------------------------------------------------+
889
+ | ``[!seq] `` | matches any character not in seq |
890
+ +------------+----------------------------------------------------------+
891
+
875
892
.. note ::
876
893
Using the "``** ``" pattern in large directory trees may consume
877
894
an inordinate amount of time.
@@ -1270,8 +1287,7 @@ call fails (for example because the path doesn't exist).
1270
1287
.. method :: Path.rglob(pattern)
1271
1288
1272
1289
Glob the given relative *pattern * recursively. This is like calling
1273
- :func: `Path.glob ` with "``**/ ``" added in front of the *pattern *, where
1274
- *patterns * are the same as for :mod: `fnmatch `::
1290
+ :func: `Path.glob ` with "``**/ ``" added in front of the *pattern *::
1275
1291
1276
1292
>>> sorted(Path().rglob("*.py"))
1277
1293
[PosixPath('build/lib/pathlib.py'),
0 commit comments