1import re
2s = 'Hello from shubhamg199630@gmail.com to priya@yahoo.com about the meeting @2PM'
3
4# \S matches any non-whitespace character
5# @ for as in the Email
6# + for Repeats a character one or more times
7lst = re.findall('\S+@\S+', s)
8print(lst)
9#['shubhamg199630@gmail.com', 'priya@yahoo.com']
1import re
2line = "should we use regex more often? let me know at 321dsasdsa@dasdsa.com.lol"
3match = re.search(r'[\w\.-]+@[\w\.-]+', line)
4match.group(0)
5'321dsasdsa@dasdsa.com.lol'