diff options
author | Athos Ribeiro <athoscribeiro@gmail.com> | 2022-10-05 00:39:42 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-05 00:39:42 (GMT) |
commit | 0ceafa7fa408b64377ea31dd5386152da19ef38a (patch) | |
tree | 6f18223942fd81bb82f6cd1826a3d56c42c95020 /Doc/library | |
parent | 395b66a0ae5237eec195ca97daaaf8563706ed34 (diff) | |
download | cpython-0ceafa7fa408b64377ea31dd5386152da19ef38a.zip cpython-0ceafa7fa408b64377ea31dd5386152da19ef38a.tar.gz cpython-0ceafa7fa408b64377ea31dd5386152da19ef38a.tar.bz2 |
Add re.VERBOSE flag documentation example (#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.
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 1b9a7b6..5b304f7 100644 --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -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. |