Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 24908f1

Browse files
Add re.VERBOSE flag documentation example (GH-97678)
The current re.VERBOSE documentation example leaves space for ambiguous interpretation. One may read that spaces within the `(?:` token are spaces inside the non-capturing group (such as `(?: )`). This patch removes the ambiguity by including examples after the statement. (cherry picked from commit 0ceafa7) Co-authored-by: Athos Ribeiro <[email protected]>
1 parent 09e5029 commit 24908f1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Doc/library/re.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,8 @@ Flags
702702
more readable by allowing you to visually separate logical sections of the
703703
pattern and add comments. Whitespace within the pattern is ignored, except
704704
when in a character class, or when preceded by an unescaped backslash,
705-
or within tokens like ``*?``, ``(?:`` or ``(?P<...>``.
705+
or within tokens like ``*?``, ``(?:`` or ``(?P<...>``. For example, ``(? :``
706+
and ``* ?`` are not allowed.
706707
When a line contains a ``#`` that is not in a character class and is not
707708
preceded by an unescaped backslash, all characters from the leftmost such
708709
``#`` through the end of the line are ignored.

0 commit comments

Comments
 (0)