summaryrefslogtreecommitdiffstats
path: root/Doc/library/re.rst
diff options
context:
space:
mode:
authororsenthil@gmail.com <orsenthil@gmail.com>2011-03-12 02:46:25 (GMT)
committerorsenthil@gmail.com <orsenthil@gmail.com>2011-03-12 02:46:25 (GMT)
commit476021b3d0d9d4378b95ada850e49b98ada4ffdd (patch)
tree244f52d29b1acb336cea4eca893a518144d21039 /Doc/library/re.rst
parentceae11de9bc30a6e57a467bcd13fc4d7e2ba551c (diff)
downloadcpython-476021b3d0d9d4378b95ada850e49b98ada4ffdd.zip
cpython-476021b3d0d9d4378b95ada850e49b98ada4ffdd.tar.gz
cpython-476021b3d0d9d4378b95ada850e49b98ada4ffdd.tar.bz2
Fix issue11283 - Clarifying a re pattern in the re module docs for conditional regex
Diffstat (limited to 'Doc/library/re.rst')
-rw-r--r--Doc/library/re.rst11
1 files changed, 6 insertions, 5 deletions
diff --git a/Doc/library/re.rst b/Doc/library/re.rst
index 423540c..3e9cf02 100644
--- a/Doc/library/re.rst
+++ b/Doc/library/re.rst
@@ -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.