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 '<user@host.com' outright -- re.search finds 'user@host.com' in it; it only fails to match the whole string. Reword to say so. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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 ``'<user@host.com>'`` as well as ``'user@host.com'``, but
535-
not with ``'<user@host.com'`` nor ``'user@host.com>'``.
534+
matches ``'<user@host.com>'`` as well as ``'user@host.com'``, but does not
535+
match ``'<user@host.com'`` nor ``'user@host.com>'`` in their entirety
536+
(:func:`re.search` finds only ``'user@host.com'`` in the former).
536537

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

0 commit comments

Comments
 (0)