@@ -387,20 +387,20 @@ \subsection{Module Contents}
387387
388388\begin {funcdesc }{split}{pattern, string, \optional {, maxsplit\code { = 0}}}
389389 Split \var {string} by the occurrences of \var {pattern}. If
390- capturing parentheses are used in pattern, then occurrences of
391- patterns or subpatterns are also returned.
390+ capturing parentheses are used in \var { pattern} , then the text of all
391+ groups in the pattern are also returned as part of the resulting list .
392392 If \var {maxsplit} is nonzero, at most \var {maxsplit} splits
393393 occur, and the remainder of the string is returned as the final
394394 element of the list. (Incompatibility note: in the original Python
395395 1.5 release, \var {maxsplit} was ignored. This has been fixed in
396396 later releases.)
397397%
398398\begin {verbatim }
399- >>> re.split('[\W] +', 'Words, words, words.')
399+ >>> re.split('\W +', 'Words, words, words.')
400400['Words', 'words', 'words', '']
401- >>> re.split('([\W] +)', 'Words, words, words.')
401+ >>> re.split('(\W +)', 'Words, words, words.')
402402['Words', ', ', 'words', ', ', 'words', '.', '']
403- >>> re.split('[\W] +', 'Words, words, words.', 1)
403+ >>> re.split('\W +', 'Words, words, words.', 1)
404404['Words', 'words, words.']
405405\end {verbatim }
406406%
0 commit comments