Skip to content

Commit 71a0b43

Browse files
committed
Rewrite re.VERBOSE section.
It now has slightly better rationale and a less awkward wording in the explanation. Inspired by a report of a neither/or conflict by 'animalize' on docs@.
1 parent e1dc3d4 commit 71a0b43

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

Doc/library/re.rst

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -548,13 +548,15 @@ form.
548548
.. data:: X
549549
VERBOSE
550550

551-
This flag allows you to write regular expressions that look nicer. Whitespace
552-
within the pattern is ignored, except when in a character class or preceded by
553-
an unescaped backslash, and, when a line contains a ``'#'`` neither in a
554-
character class or preceded by an unescaped backslash, all characters from the
555-
leftmost such ``'#'`` through the end of the line are ignored.
556-
557-
That means that the two following regular expression objects that match a
551+
This flag allows you to write regular expressions that look nicer and are
552+
more readable by allowing you to visually separate logical sections of the
553+
pattern and add comments. Whitespace within the pattern is ignored, except
554+
when in a character class or when preceded by an unescaped backslash.
555+
When a line contains a ``#`` that is not in a character class and is not
556+
preceded by an unescaped backslash, all characters from the leftmost such
557+
``#`` through the end of the line are ignored.
558+
559+
This means that the two following regular expression objects that match a
558560
decimal number are functionally equal::
559561

560562
a = re.compile(r"""\d + # the integral part

0 commit comments

Comments
 (0)