regular expression ".split" does not work with look-ahead groups

Create issue
Issue #3089 closed
João Sebastião de Oliveira Bueno created an issue

This are the results in cPython:

>>> import re
>>> re.split("(?=3)", "12345")
['12', '345']

And this is what I get in pypy3:

>>>> import re
>>>> re.split("(?=3)", "12345")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/pypy3-7.0/lib-python/3/re.py", line 203, in split
    return _compile(pattern, flags).split(string, maxsplit)
ValueError: split() requires a non-empty pattern match.

Comments (3)

  1. Armin Rigo

    This is new in CPython 3.7. In CPython 3.5 and 3.6, we get the same ValueError. Assuming there are tests for this new feature of CPython 3.7 (which is probable) then we'll fix it in the py3.7 branch once we reach it.

  2. Log in to comment