Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python extract mails from string

import re
line = "should we use regex more often? let me know at  321dsasdsa@dasdsa.com.lol"
match = re.search(r'[w.+-]+@[w-]+.[w.-]+', line)
print(match.group(0))
# '321dsasdsa@dasdsa.com.lol'

# or for multiple adresses
line = "should we use regex more often? let me know at  321dsasdsa@dasdsa.com.lol or dadaads@dsdds.com"
match = re.findall(r'[w.+-]+@[w-]+.[w.-]+', line)
print(match)
# ['321dsasdsa@dasdsa.com.lol', 'dadaads@dsdds.com']
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #extract #mails #string
ADD COMMENT
Topic
Name
3+4 =