Split the source string by the occurrences of the pattern, returning a list containing the resulting substrings. If capturing parentheses are used in pattern, then the text of all groups in the pattern are also returned as part of the resulting list. If maxsplit is nonzero, at
(pattern, string, maxsplit=0, flags=0)
| 196 | return _compile(pattern, flags).subn(repl, string, count) |
| 197 | |
| 198 | def split(pattern, string, maxsplit=0, flags=0): |
| 199 | """Split the source string by the occurrences of the pattern, |
| 200 | returning a list containing the resulting substrings. If |
| 201 | capturing parentheses are used in pattern, then the text of all |
| 202 | groups in the pattern are also returned as part of the resulting |
| 203 | list. If maxsplit is nonzero, at most maxsplit splits occur, |
| 204 | and the remainder of the string is returned as the final element |
| 205 | of the list.""" |
| 206 | return _compile(pattern, flags).split(string, maxsplit) |
| 207 | |
| 208 | def findall(pattern, string, flags=0): |
| 209 | """Return a list of all non-overlapping matches in the string. |