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

index 49c241d1d93bb78f16fe7b0666d687e7959cfae9..1d90f791a720c7f2053a545f07303f6a53b2ca7a 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.