summaryrefslogtreecommitdiffstats
path: root/Doc/howto
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-01-04 09:06:13 (GMT)
committerGitHub <noreply@github.com>2018-01-04 09:06:13 (GMT)
commitfbb490fd2f38bd817d99c20c05121ad0168a38ee (patch)
tree417d39bc824e6e62503f94033dbd2b37a8b5545b /Doc/howto
parent0cc99c8cd70d422e4b345837a907db30e9180ab9 (diff)
downloadcpython-fbb490fd2f38bd817d99c20c05121ad0168a38ee.zip
cpython-fbb490fd2f38bd817d99c20c05121ad0168a38ee.tar.gz
cpython-fbb490fd2f38bd817d99c20c05121ad0168a38ee.tar.bz2
bpo-32308: Replace empty matches adjacent to a previous non-empty match in re.sub(). (#4846)
Diffstat (limited to 'Doc/howto')
-rw-r--r--Doc/howto/regex.rst4
1 files changed, 2 insertions, 2 deletions
diff --git a/Doc/howto/regex.rst b/Doc/howto/regex.rst
index fa8c693..87a6b1a 100644
--- a/Doc/howto/regex.rst
+++ b/Doc/howto/regex.rst
@@ -1140,12 +1140,12 @@ new string value and the number of replacements that were performed::
>>> p.subn('colour', 'no colours at all')
('no colours at all', 0)
-Empty matches are replaced only when they're not adjacent to a previous match.
+Empty matches are replaced only when they're not adjacent to a previous empty match.
::
>>> p = re.compile('x*')
>>> p.sub('-', 'abxd')
- '-a-b-d-'
+ '-a-b--d-'
If *replacement* is a string, any backslash escapes in it are processed. That
is, ``\n`` is converted to a single newline character, ``\r`` is converted to a