usgs / groundmotion-processing

Parsing and processing ground motion data
Other
54 stars 42 forks source link

Email validation is too restrictive #921

Closed emthompson-usgs closed 2 years ago

emthompson-usgs commented 2 years ago

We are currently using this regular expression string to validate:

re_email = r"^[a-z0-9]+[\._]?[a-z0-9]+[@]\w+[.]\w{2,3}$"
if not re.search(re_email, user_info["email"]):
    print("Invalid Email. Exiting.")

But this doesn't allow for a hyphen in the email, which is a valid email address.

We need to modify the string to allow for hyphens.