[Python-checkins] cpython (3.1): Fix issue11283 - Clarifying a re pattern in the re module docs for conditional
senthil.kumaran
python-checkins at python.org
Sat Mar 12 04:44:22 CET 2011
http://hg.python.org/cpython/rev/d676601fee6f
changeset: 68391:d676601fee6f
branch: 3.1
parent: 68384:f040a34102de
user: Senthil Kumaran <orsenthil at gmail.com>
date: Sat Mar 12 11:40:25 2011 +0800
summary:
Fix issue11283 - Clarifying a re pattern in the re module docs for conditional regex
files:
Doc/library/re.rst
diff --git a/Doc/library/re.rst b/Doc/library/re.rst
--- a/Doc/library/re.rst
+++ b/Doc/library/re.rst
@@ -295,11 +295,12 @@
match at the beginning of the string being searched.
``(?(id/name)yes-pattern|no-pattern)``
- Will try to match with ``yes-pattern`` if the group with given *id* or *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 at host.com>'`` as well as
- ``'user at host.com'``, but not with ``'<user at host.com'``.
+ Will try to match with ``yes-pattern`` if the group with given *id* or
+ *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 at host.com>'`` as well as ``'user at host.com'``, but
+ not with ``'<user at host.com'`` nor ``'user at host.com>'`` .
The special sequences consist of ``'\'`` and a character from the list below.
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list