import rerx = r"\S+@\S+\.\S+|(\w+\.\w+)"s = "a.a b.b:c.c d.d@e.e.e"res = filter(None, re.findall(rx, s))print(res)
Standard input is empty
['a.a', 'b.b', 'c.c']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!