From 222907da5694097da7a6ee7ad1f89c53e024b550 Mon Sep 17 00:00:00 2001 From: Skip Montanaro Date: Sat, 1 Sep 2007 17:40:03 +0000 Subject: [PATCH] Added a note and examples to explain that re.split does not split on an empty pattern match. (issue 852532). --- Doc/library/re.rst | 7 +++++++ 1 file changed, 7 insertions(+) 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]) -- 2.50.0