def megasplit(pattern, string):
    splits = list((m.start(), m.end()) for m in re.finditer(pattern, string))
starts = [0] + [i[1] for i in splits]
ends = [i[0] for i in splits] + [len(string)]
return [string[start:end] for start, end in zip(starts, ends)]
print(megasplit('(?<!foo)(?=bar)', 'foobarbarbazbar'))
print(megasplit('o', 'foobarbarbazbar'))
Python regex: splitting on pattern match that is an empty string