summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSkip Montanaro <skip@pobox.com>2007-09-01 17:40:03 +0000
committerSkip Montanaro <skip@pobox.com>2007-09-01 17:40:03 +0000
commit222907da5694097da7a6ee7ad1f89c53e024b550 (patch)
tree6790cd5a0936a872044776c632fb4c9dc7d3b952
parent847cae6743aa43aa51efae0d8e6066b84a52b9a9 (diff)
downloadcpython-git-222907da5694097da7a6ee7ad1f89c53e024b550.tar.gz
Added a note and examples to explain that re.split does not split on an
empty pattern match. (issue 852532).
-rw-r--r--Doc/library/re.rst7
1 files changed, 7 insertions, 0 deletions
diff --git a/Doc/library/re.rst b/Doc/library/re.rst
index d5abcdd2a2..e01a8cc726 100644
--- a/Doc/library/re.rst
+++ b/Doc/library/re.rst
@@ -544,6 +544,13 @@ form.
>>> re.split('\W+', 'Words, words, words.', 1)
['Words', 'words, words.']
+ Note that *split* will never split a string on an empty pattern match.
+ For example ::
+
+ >>> re.split('x*', 'foo')
+ ['foo']
+ >>> re.split("(?m)^$", "foo\n\nbar\n")
+ ['foo\n\nbar\n']
.. function:: findall(pattern, string[, flags])