mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
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
1 changed files with 7 additions and 0 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue