https://github.com/python/cpython/commit/fe9c7213e6576e27ebff6ef039706cd463593310 commit: fe9c7213e6576e27ebff6ef039706cd463593310 branch: main author: Serhiy Storchaka <[email protected]> committer: serhiy-storchaka <[email protected]> date: 2026-07-05T07:48:02Z summary:
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]> files: M Doc/library/re.rst diff --git a/Doc/library/re.rst b/Doc/library/re.rst index 617dc96f479926..1aefb91e0ceb40 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 ``'<[email protected]>'`` as well as ``'[email protected]'``, but - not with ``'<[email protected]'`` nor ``'[email protected]>'``. + matches ``'<[email protected]>'`` as well as ``'[email protected]'``, but does not + match ``'<[email protected]'`` nor ``'[email protected]>'`` in their entirety + (:func:`re.search` finds only ``'[email protected]'`` in the former). .. versionchanged:: 3.12 Group *id* can only contain ASCII digits. _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
