Skip to content

Commit 1925d3d

Browse files
serhiy-storchakaclaude
authored andcommitted
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. (cherry picked from commit fe9c721) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent c099aa1 commit 1925d3d

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
@@ -512,8 +512,9 @@ The special characters are:
512512
*name* exists, and with ``no-pattern`` if it doesn't. ``no-pattern`` is
513513
optional and can be omitted. For example,
514514
``(<)?(\w+@\w+(?:\.\w+)+)(?(1)>|$)`` is a poor email matching pattern, which
515-
will match with ``'<user@host.com>'`` as well as ``'user@host.com'``, but
516-
not with ``'<user@host.com'`` nor ``'user@host.com>'``.
515+
matches ``'<user@host.com>'`` as well as ``'user@host.com'``, but does not
516+
match ``'<user@host.com'`` nor ``'user@host.com>'`` in their entirety
517+
(:func:`re.search` finds only ``'user@host.com'`` in the former).
517518

518519
.. versionchanged:: 3.12
519520
Group *id* can only contain ASCII digits.

0 commit comments

Comments
 (0)