Skip to content

Commit c2d4826

Browse files
athos-ribeiromiss-islington
authored andcommitted
Add re.VERBOSE flag documentation example (pythonGH-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 <athoscribeiro@gmail.com>
1 parent 994eaa3 commit c2d4826

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Doc/library/re.rst

Lines changed: 2 additions & 1 deletion
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)