[Python-checkins] cpython: Fix issue11283 - Clarifying a re pattern in the re module docs for conditional

senthil.kumaran python-checkins at python.org
Sat Mar 12 03:49:04 CET 2011


http://hg.python.org/cpython/rev/06cca90ff105
changeset:   68390:06cca90ff105
parent:      68388:20c91fcc2ca6
user:        orsenthil at gmail.com
date:        Sat Mar 12 10:46: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