fork(1) download
  1. import itertools, re
  2. s = "hello, my name is Joseph! Haha, hello!"
  3. print(["".join(x) for _, x in itertools.groupby(s, key=str.isalnum)][0::2])
  4. print(re.findall(r"\w+", s))
Success #stdin #stdout 0s 9024KB
stdin
Standard input is empty
stdout
['hello', 'my', 'name', 'is', 'Joseph', 'Haha', 'hello']
['hello', 'my', 'name', 'is', 'Joseph', 'Haha', 'hello']