summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorSenthil Kumaran <orsenthil@gmail.com>2011-03-12 03:40:25 (GMT)
committerSenthil Kumaran <orsenthil@gmail.com>2011-03-12 03:40:25 (GMT)
commitabd4a0556142e971c22d23243bacd3f0ad6d2299 (patch)
treef14c0db4249f98c47c3960669f0dae0da7d0407e /Doc/library
parent26606fd23f4e5a27d43de8f745491e960b10e84a (diff)
downloadcpython-abd4a0556142e971c22d23243bacd3f0ad6d2299.zip
cpython-abd4a0556142e971c22d23243bacd3f0ad6d2299.tar.gz
cpython-abd4a0556142e971c22d23243bacd3f0ad6d2299.tar.bz2
Fix issue11283 - Clarifying a re pattern in the re module docs for conditional regex
Diffstat (limited to 'Doc/library')
-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 49c241d..1d90f79 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.