Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed address validator #319

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions Address Validator/AddressValidator.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
def addressVal(address):
dot = address.find(".")
at = address.find("@")
if (dot == -1):
print("Invalid")
elif (at == -1):
print("Invalid")
else:
import re


def addressVal(address: str) -> None:
address_pattern: str = r"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$"
if re.fullmatch(address_pattern, address):
print("Valid")
else:
print("Invalid")

print("This program will decide if your input is a valid email address")
while(True):
print("A valid email address needs an '@' symbol and a '.'")
x = input("Input your email address:")

addressVal(x)
print("This program will decide if your input is a valid email address")
while True:
print("A valid email address should look like '[email protected]'")
address = input("Input your email address:")
addressVal(address)
Binary file not shown.