From: Athos Ribeiro Date: Wed, 5 Oct 2022 00:39:42 +0000 (-0300) Subject: Add re.VERBOSE flag documentation example (#97678) X-Git-Tag: v3.12.0a1~250 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0ceafa7fa408b64377ea31dd5386152da19ef38a;p=thirdparty%2FPython%2Fcpython.git 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. --- diff --git a/Doc/library/re.rst b/Doc/library/re.rst index 1b9a7b63ef5e..5b304f717b07 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.