From 5861f5391c4f76e8d16f5868f0ed91a3399265b4 Mon Sep 17 00:00:00 2001 From: Athos Ribeiro Date: Fri, 30 Sep 2022 11:00:14 -0300 Subject: [PATCH] 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. --- Doc/library/re.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/library/re.rst b/Doc/library/re.rst index 1b9a7b63ef5e1b..5b304f717b07fa 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.