i want to parse @google.com from this string
str = 'purple [email protected] monkey dishwasher'
and print it
import re
str = 'purple [email protected] monkey dishwasher'
match = re.search(r'\@\w ', str)
a=re.match(r'(@)://.*\.( )$', str)
if match:
print(a.group())
CodePudding user response:
Please do not overwrite python types. Give your str
variable another name than str
.
Maybe try finding @google.com like this: re.findall(r'@\w \.\w ', your_string)