diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-10-05 01:37:01 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-05 01:37:01 (GMT) |
commit | 24908f1f207f4642fc57ae79c69a3dcb0770a96a (patch) | |
tree | e38d51693068a05a5d7187b262928abc4ef34102 /Doc/library | |
parent | 09e5029aca36c21157516bb44269644084fdf9ad (diff) | |
download | cpython-24908f1f207f4642fc57ae79c69a3dcb0770a96a.zip cpython-24908f1f207f4642fc57ae79c69a3dcb0770a96a.tar.gz cpython-24908f1f207f4642fc57ae79c69a3dcb0770a96a.tar.bz2 |
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 0ceafa7fa408b64377ea31dd5386152da19ef38a)
Co-authored-by: Athos Ribeiro <athoscribeiro@gmail.com>
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/re.rst | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Doc/library/re.rst b/Doc/library/re.rst index fd12241..e7d1f05 100644 --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -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. |