mirror of
https://github.com/python/cpython.git
synced 2026-07-25 11:22:45 -04:00
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>
This commit is contained in:
+3
-2
@@ -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 ``'<user@host.com>'`` as well as ``'user@host.com'``, but
|
||||
not with ``'<user@host.com'`` nor ``'user@host.com>'``.
|
||||
matches ``'<user@host.com>'`` as well as ``'user@host.com'``, but does not
|
||||
match ``'<user@host.com'`` nor ``'user@host.com>'`` in their entirety
|
||||
(:func:`re.search` finds only ``'user@host.com'`` in the former).
|
||||
|
||||
.. versionchanged:: 3.12
|
||||
Group *id* can only contain ASCII digits.
|
||||
|
||||
Reference in New Issue
Block a user