Python seems to have a rather surprising behavior when matching groups in Python:
>>> re.split("\+|-", "1+2")
['1', '2']
>>> re.split("(\+|-)", "1+2")
['1', '+', '2']
I haven't found any satisfying explanation for why grouping a single expression would prevent it from being matched, so what's the problem here?
According to regex101 there is absolutely no difference when it comes to matching, although more steps are required.