To find the mail id in the given string
Problem to find the mail id in given string. The valid mail id format is [email protected]
Example-2:
Input : s = Welcome to [email protected] Output : ['[email protected]']
Example-1:
Input : s = [email protected] and [email protected] Output : ['[email protected]', '[email protected]']
Example-2:
Input : n = hello world Output : []
Solution
import re s = "welcome to [email protected]" r = re.findall(r"[a-zA-Z0-9][email protected]+[a-zA-Z]+\.+[a-zA-Z]+",s) print(r)