From f4bc33c895aa32b27a931cde887e162e73719bf3 Mon Sep 17 00:00:00 2001 From: Peter John Date: Fri, 31 Jul 2015 11:30:26 +0530 Subject: [PATCH] fix(formats): email regex --- src/themis.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/themis.js b/src/themis.js index fb64d8a..8087992 100644 --- a/src/themis.js +++ b/src/themis.js @@ -480,8 +480,8 @@ var Utils = { if (typeof email !== "string") { return true; } - // use regex from owasp: https://www.owasp.org/index.php/OWASP_Validation_Regex_Repository - return /^[a-zA-Z0-9+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,7}$/.test(email); + // http://emailregex.com/ + return /^[-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}{\'?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+)*\.(aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|mobi|[a-z][a-z])|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?$/i.test(email); }, "hostname": function (hostname) { if (typeof hostname !== "string") {