i have a file with rows like
From [email protected] Fri Jan 4 06:08:27 2008
Received: (from apache@localhost)
Return-Path: <[email protected]>
for <[email protected]>;
I was trying to read each line and use regular expression to find the domain name, basically the portion after the sign @. Here is the code I wrote
if re.search('[@]\S+?', line) : org = re.findall('@(\S+)',line)[0]
But it returns the following results
uct.ac.za
localhost)
collab.sakaiproject.org>
collab.sakaiproject.org>;
Is there any smart way to only keep the domain and do not include the ')', '>' or '>;' followed by the domain name?