Extrait Python Mail de String
import re
line = "should we use regex more often? let me know at [email protected]"
match = re.search(r'[\w.+-]+@[\w-]+\.[\w.-]+', line)
print(match.group(0))
# '[email protected]'
# or for multiple adresses
line = "should we use regex more often? let me know at [email protected] or [email protected]"
match = re.findall(r'[\w.+-]+@[\w-]+\.[\w.-]+', line)
print(match)
# ['[email protected]', '[email protected]']
haidook.dev