This is my first question!
What should the pattern be in order to make the last "!" appear as an item on this split list?
import re
re.split(r'([.?!]) ', 'One sentence. Another one? And the last one!')
I get: ['One sentence', '.', 'Another one', '?', 'And the last one!'], or ['One sentence', '.', 'Another one', '?', 'And the last one', '!', ''] if I use ([.?!]) ?.
But I'd like to get this list: ['One sentence', '.', 'Another one', '?', 'And the last one', '!']
Thank you!