aboutsummaryrefslogtreecommitdiffstats
path: root/python/etatsbasen.py
diff options
context:
space:
mode:
authorAnders Einar Hilden <hildenae@gmail.com>2015-07-05 23:04:57 +0200
committerAnders Einar Hilden <hildenae@gmail.com>2015-07-05 23:04:57 +0200
commit9082362c39ae6ce972298a158cb3f3e88077e619 (patch)
treebfe3585e109735ab0758266ecef981bf58ec4b84 /python/etatsbasen.py
parentde8ea0be1ccc8b07c12bf584e53f152c5012c8e6 (diff)
Use js regexp for email, add additional email-fix
Diffstat (limited to 'python/etatsbasen.py')
-rwxr-xr-xpython/etatsbasen.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/python/etatsbasen.py b/python/etatsbasen.py
index 79b6481..d3db8a7 100755
--- a/python/etatsbasen.py
+++ b/python/etatsbasen.py
@@ -33,14 +33,14 @@ def cleanup_email(string):
for fix2 in split:
if fix2 == valid_email(fix2):
return fix2
+ fix3 = re.sub(r"\.$", "", string)
+ if fix3 == valid_email(fix3):
+ return fix3
return False
def valid_email(string):
- # Think about using https://pypi.python.org/pypi/validate_email ?
- name, email = parseaddr(string)
- if (email == string and '@' in email):
- return email
-
+ if re.match(r"^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$", string):
+ return string
def filter_orgstructid(row, categories):
if row == None: