fork download
  1. import re
  2. regex = r"([^\W_])\.(?:[^\S\n\r]+|$)"
  3. text = "I want a hotel.\nmy email is zob@gmail.com\nI have to play. bye!"
  4. print( re.sub(regex, r"\1 . ", text, flags=re.M).rstrip() )
Success #stdin #stdout 0.01s 7112KB
stdin
Standard input is empty
stdout
I want a hotel . 
my email is zob@gmail.com
I have to play . bye!