import re pattern = r"\w\.\.\.(?=\w)"s = "hello...world"result = re.sub(pattern, r"\g<0> ", s,) if result: print (result)
Standard input is empty
hello... world
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!