Skip to content

Commit

Permalink
Add re.VERBOSE flag documentation example (pythonGH-97678)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
athos-ribeiro authored and miss-islington committed Oct 5, 2022
1 parent 994eaa3 commit c2d4826
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Doc/library/re.rst
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,8 @@ Flags
more readable by allowing you to visually separate logical sections of the
pattern and add comments. Whitespace within the pattern is ignored, except
when in a character class, or when preceded by an unescaped backslash,
or within tokens like ``*?``, ``(?:`` or ``(?P<...>``.
or within tokens like ``*?``, ``(?:`` or ``(?P<...>``. For example, ``(? :``
and ``* ?`` are not allowed.
When a line contains a ``#`` that is not in a character class and is not
preceded by an unescaped backslash, all characters from the leftmost such
``#`` through the end of the line are ignored.
Expand Down

0 comments on commit c2d4826

Please sign in to comment.