Skip to content

Instantly share code, notes, and snippets.

@johnifegwu
Created March 17, 2020 03:56
Show Gist options
  • Save johnifegwu/29210ab58010d478be98b1fd19cba577 to your computer and use it in GitHub Desktop.
Save johnifegwu/29210ab58010d478be98b1fd19cba577 to your computer and use it in GitHub Desktop.
Email Extraction and Validation
import re
#Character Classess
#email extraction / validation
#Email Address
pattern = r"([\w\.-]+)@([\w\.-]+)(\.[\w\.]+)"
while True:
email = input("Enter a valid email address: ")
str = "For enquiries, please write to " + email
print(str + "\n permorming a search...\n")
match = re.search(pattern, str)
if match:
print(" Successful!\n You entered a Valid email address. \n Your email add is: " + match.group())
else:
print(" Failed! \n You have entered an Invalid email address.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment