cpython: d676601fee6f (original) (raw)
Mercurial > cpython
changeset 68391:d676601fee6f 3.1
Fix issue11283 - Clarifying a re pattern in the re module docs for conditional regex [#11283]
Senthil Kumaran orsenthil@gmail.com | |
---|---|
date | Sat, 12 Mar 2011 11:40:25 +0800 |
parents | f040a34102de |
children | ba2a1064b3dd 1c4be28cda5b |
files | Doc/library/re.rst |
diffstat | 1 files changed, 6 insertions(+), 5 deletions(-)[+] [-] Doc/library/re.rst 11 |
line wrap: on
line diff
--- 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.