Here\'s the simplest way to explain this. Here\'s what I\'m using:
re.split(\'\\W\', \'foo/bar spam\\neggs\') -> [\'foo\', \'bar\', \'spam\', \'eggs\'] >
One Lazy and Simple Solution
Assume your regex pattern is split_pattern = r'(!|\?)'
split_pattern = r'(!|\?)'
First, you add some same character as the new separator, like '[cut]'
new_string = re.sub(split_pattern, '\\1[cut]', your_string)
Then you split the new separator, new_string.split('[cut]')
new_string.split('[cut]')