[Python-checkins] r57878 - python/trunk/Doc/library/re.rst

skip.montanaro python-checkins at python.org
Sat Sep 1 19:40:30 CEST 2007


Author: skip.montanaro
Date: Sat Sep  1 19:40:03 2007
New Revision: 57878

Modified:
   python/trunk/Doc/library/re.rst
Log:
Added a note and examples to explain that re.split does not split on an
empty pattern match. (issue 852532).



Modified: python/trunk/Doc/library/re.rst
==============================================================================
--- python/trunk/Doc/library/re.rst	(original)
+++ python/trunk/Doc/library/re.rst	Sat Sep  1 19:40:03 2007
@@ -544,6 +544,13 @@
       >>> 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])
 


More information about the Python-checkins mailing list