-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
34 lines (27 loc) · 1011 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# == START OF PROGRAM DETAILS == #
###
# NAME: EMAIL SLICER
# SHORT_DISC: The email slicer is a handy program to get the username and domain name from an email address.
# You can customize and send a message to the user with this information.
# PARAMS: email - str EX: deniernal354@github.com
# LIBRARIES/DEPENDENCIES: re
###
# == END OF PROGRAM DETAILS == #
# == VALIDATION ==
# - Any input of any case is valid >> DONE
# == VALIDATION ==
import re
regex = r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)"
# email = input("Enter your email: ")
email = "deniernal354@github.com"
def validate():
global email
validateStatus = re.match(regex, email)
if validateStatus == False:
print("Incorrect email format, please try again!")
email = input("Enter your email: ")
def getUsernameAndGetDomainName():
global email
return print("Email Username: " + email.split("@")[0] + "\nEmail Domain: " + email.split("@")[1])
validate()
getUsernameAndGetDomainName()