8000 Add re.VERBOSE flag documentation example by athos-ribeiro · Pull Request #97678 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

Add re.VERBOSE flag documentation example 8000 #97678

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add re.VERBOSE flag documentation example
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.
  • Loading branch information
athos-ribeiro committed Oct 4, 2022
commit 5861f5391c4f76e8d16f5868f0ed91a3399265b4
3 changes: 2 additions & 1 deletion Doc/library/re.rst
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,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