Skip to content

Commit df9b714

Browse files
agattidpgeorge
authored andcommitted
docs/library/re: Document non-capturing grouping.
This commit updates the documentation for the `re` library, officially documenting non-capturing grouping rules (ie. "(?:...)"). The documentation mistakenly marked that feature as not supported, but is is indeed supported in the current iteration of the regex library. This closes #18900. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
1 parent e4920d6 commit df9b714

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

docs/library/re.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ Supported operators and special sequences are:
5454
Grouping. Each group is capturing (a substring it captures can be accessed
5555
with `match.group()` method).
5656

57+
``(?:...)``
58+
Non-capturing grouping. Each group is matched using the same rules as
59+
regular grouping, but will not be part of the match object.
60+
5761
``\d``
5862
Matches digit. Equivalent to ``[0-9]``.
5963

@@ -87,7 +91,6 @@ Supported operators and special sequences are:
8791

8892
* counted repetitions (``{m,n}``)
8993
* named groups (``(?P<name>...)``)
90-
* non-capturing groups (``(?:...)``)
9194
* more advanced assertions (``\b``, ``\B``)
9295
* special character escapes like ``\r``, ``\n`` - use Python's own escaping
9396
instead

0 commit comments

Comments
 (0)