fork download
  1. import re
  2. rx = r"\w+(?:\.\w+)*|[^\w\s]"
  3. s = "Mr.Smith is a professor at Harvard, and is a great guy."
  4. print(re.findall(rx, s))
  5.  
Success #stdin #stdout 0.02s 9460KB
stdin
Standard input is empty
stdout
['Mr.Smith', 'is', 'a', 'professor', 'at', 'Harvard', ',', 'and', 'is', 'a', 'great', 'guy', '.']