mirror of https://github.com/python/cpython
Added a note and examples to explain that re.split does not split on an
empty pattern match. (issue 852532).
This commit is contained in:
parent
847cae6743
commit
222907da56
|
@ -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])
|
||||
|
||||
|
|
Loading…
Reference in New Issue