[issue36397] re.split() incorrectly splitting on zero-width pattern

Matthew Barnett report at bugs.python.org
Thu Mar 21 23:26:31 EDT 2019


Matthew Barnett <python at mrabarnett.plus.com> added the comment:

>From the docs:

"""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."""

The pattern does contain a capture, so that's why the result has additional '1' and '2'.

Presumably, Java's split doesn't do that.

Not a bug.

----------
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36397>
_______________________________________


More information about the Python-bugs-list mailing list