2020-09-11 09:25:19 -05:00
|
|
|
##########################################################################
|
|
|
|
#
|
|
|
|
# pgAdmin 4 - PostgreSQL Tools
|
|
|
|
#
|
2021-01-04 04:04:45 -06:00
|
|
|
# Copyright (C) 2013 - 2021, The pgAdmin Development Team
|
2020-09-11 09:25:19 -05:00
|
|
|
# This software is released under the PostgreSQL Licence
|
|
|
|
#
|
|
|
|
##########################################################################
|
|
|
|
|
|
|
|
import re
|
|
|
|
|
|
|
|
|
|
|
|
def validate_email(email):
|
|
|
|
if email == '' or email is None:
|
|
|
|
return False
|
|
|
|
|
|
|
|
email_filter = re.compile(
|
|
|
|
"^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9]"
|
|
|
|
"(?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9]"
|
|
|
|
"(?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$"
|
|
|
|
)
|
|
|
|
|
|
|
|
if not email_filter.match(email):
|
|
|
|
return False
|
|
|
|
|
|
|
|
return True
|