From: Serhiy Storchaka Date: Sun, 5 Jul 2026 07:48:02 +0000 (+0300) Subject: gh-151819: Clarify the conditional-pattern email example in re docs (GH-153072) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fe9c7213e6576e27ebff6ef039706cd463593310;p=thirdparty%2FPython%2Fcpython.git gh-151819: Clarify the conditional-pattern email example in re docs (GH-153072) The example pattern does not fail to match ' --- diff --git a/Doc/library/re.rst b/Doc/library/re.rst index 617dc96f4799..1aefb91e0ceb 100644 --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -531,8 +531,9 @@ The special characters are: *name* exists, and with ``no-pattern`` if it doesn't. ``no-pattern`` is optional and can be omitted. For example, ``(<)?(\w+@\w+(?:\.\w+)+)(?(1)>|$)`` is a poor email matching pattern, which - will match with ``''`` as well as ``'user@host.com'``, but - not with ``''``. + matches ``''`` as well as ``'user@host.com'``, but does not + match ``''`` in their entirety + (:func:`re.search` finds only ``'user@host.com'`` in the former). .. versionchanged:: 3.12 Group *id* can only contain ASCII digits.