From b31cfc29d4c56d840c51d58e0982b6cc1035467e Mon Sep 17 00:00:00 2001 From: Dennis Date: Tue, 18 Jan 2022 10:10:37 +0900 Subject: [PATCH] changed regex to accept Top-level domain with length 63 --- src/jqBootstrapValidation.js | 2 +- test/jqBootstrapValidation_test.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/jqBootstrapValidation.js b/src/jqBootstrapValidation.js index 77767dc..375cac0 100644 --- a/src/jqBootstrapValidation.js +++ b/src/jqBootstrapValidation.js @@ -819,7 +819,7 @@ name: "email", init: function ($this, name) { var result = {}; - result.regex = regexFromString('[a-zA-Z0-9.!#$%&\u2019*+/=?^_`{|}~-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}'); + result.regex = regexFromString('[a-zA-Z0-9.!#$%&\u2019*+/=?^_`{|}~-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,63}'); var message = "Not a valid email address"; if ($this.data("validation" + name + "Message")) { diff --git a/test/jqBootstrapValidation_test.js b/test/jqBootstrapValidation_test.js index c025a05..be67b42 100644 --- a/test/jqBootstrapValidation_test.js +++ b/test/jqBootstrapValidation_test.js @@ -178,7 +178,8 @@ '!def!xyz%abc@example.com', '_somename@example.com', 'test@example.com', - '\u2019test\u2019@example.com' + '\u2019test\u2019@example.com', + 'someone@tld63char.abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabc' ]; test('accepts valid', validEmails.length * numInJQBVTest, function() { $(validEmails).each(function (i, el) {