Skip to content

Commit fe9c721

Browse files
gh-151819: Clarify the conditional-pattern email example in re docs (GH-153072)
The example pattern does not fail to match '<[email protected]' outright -- re.search finds '[email protected]' in it; it only fails to match the whole string. Reword to say so. Co-authored-by: Claude Opus 4.8 <[email protected]>
1 parent 600e864 commit fe9c721

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎Doc/library/re.rst‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,8 +531,9 @@ The special characters are:
531531
*name* exists, and with ``no-pattern`` if it doesn't. ``no-pattern`` is
532532
optional and can be omitted. For example,
533533
``(<)?(\w+@\w+(?:\.\w+)+)(?(1)>|$)`` is a poor email matching pattern, which
534-
will match with ``'<[email protected]>'`` as well as ``'[email protected]'``, but
535-
not with ``'<[email protected]'`` nor ``'[email protected]>'``.
534+
matches ``'<[email protected]>'`` as well as ``'[email protected]'``, but does not
535+
match ``'<[email protected]'`` nor ``'[email protected]>'`` in their entirety
536+
(:func:`re.search` finds only ``'[email protected]'`` in the former).
536537

537538
.. versionchanged:: 3.12
538539
Group *id* can only contain ASCII digits.

0 commit comments

Comments
 (0)