From: Skip Montanaro Date: Sat, 1 Sep 2007 17:40:03 +0000 (+0000) Subject: Added a note and examples to explain that re.split does not split on an X-Git-Tag: v2.6a1~1362 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=222907da5694097da7a6ee7ad1f89c53e024b550;p=python Added a note and examples to explain that re.split does not split on an empty pattern match. (issue 852532). --- 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])