]> granicus.if.org Git - python/commitdiff
Fix issue11283 - Clarifying a re pattern in the re module docs for conditional regex
authororsenthil@gmail.com <orsenthil@gmail.com>
Sat, 12 Mar 2011 02:46:25 +0000 (10:46 +0800)
committerorsenthil@gmail.com <orsenthil@gmail.com>
Sat, 12 Mar 2011 02:46:25 +0000 (10:46 +0800)
Doc/library/re.rst

index 423540c48bdaa0287726e3fc7bf1b9e24bfa7f32..3e9cf026f07df167f3782fab53c9b48803247809 100644 (file)
@@ -295,11 +295,12 @@ The special characters are:
    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@host.com>'`` as well as
-   ``'user@host.com'``, but not with ``'<user@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@host.com>'`` as well as ``'user@host.com'``, but
+   not with ``'<user@host.com'`` nor ``'user@host.com>'`` .
 
 
 The special sequences consist of ``'\'`` and a character from the list below.