import rerx = r"\w+(?:'\w+)?|[^\w\s]"s = "I don't like to eat Cici's food (it is true)"print(re.findall(rx, s))
Standard input is empty
['I', "don't", 'like', 'to', 'eat', "Cici's", 'food', '(', 'it', 'is', 'true', ')']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!