Search
 
SCRIPT & CODE EXAMPLE
 

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']
Comment

PREVIOUS NEXT
Code Example
Python :: python opencv create new image 
Python :: finding 2 decimal places python 
Python :: rearrange list 
Python :: write txt python 
Python :: python for property in object 
Python :: install pyaudio linux 
Python :: python check if character before character in alphabet 
Python :: pip install dal 
Python :: python search for string in file 
Python :: ros python subscriber 
Python :: python default dictonary 
Python :: seasonal_decompose python 
Python :: python generate list alphabet 
Python :: python mod inverse 
Python :: pandas read ods 
Python :: pandas diff between dates 
Python :: pandas rename single column 
Python :: epoch to datetime utc python 
Python :: # find the common elements in the list. 
Python :: how to pipe using sybprosses run python 
Python :: how to add subplots for histogram in pandas 
Python :: filter an importrange 
Python :: import data in pandad 
Python :: python n choose r 
Python :: remove substring python 
Python :: take off character in python string 
Python :: for each value in column pandas 
Python :: python replace multiple spacis with spaces 
Python :: convert number to binary python 
Python :: how to print dataframe in python without index 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =