fork(1) download
  1. import re
  2.  
  3. emails = ['John Kennedy <jk123@gmail.com> or <johnk123@hotmail.com>','Adam Hartley <ah123@yahoo.com>','Ben Saunders <benji@live.co.uk>']
  4. def myfunction(bigstring):
  5. result = []
  6. for s in bigstring:
  7. result.append(re.findall(r'[\w.-]+@[\w.-]+', s))
  8. return result
  9.  
  10. print(myfunction(emails))
Success #stdin #stdout 0.02s 9372KB
stdin
Standard input is empty
stdout
[['jk123@gmail.com', 'johnk123@hotmail.com'], ['ah123@yahoo.com'], ['benji@live.co.uk']]