aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorneilmcgibbon2013-08-02 14:57:58 +0100
committerMatias Niemelä2013-08-07 14:18:22 -0400
commitad76e77fce09d0aee28b5ca1a328d5df8596b935 (patch)
tree6c5a4eb67780a67050032a0cdea80d758ac38537
parentac5b9055f6d7224e5e8e49941c0fc9cb16c64a7e (diff)
downloadangular.js-ad76e77fce09d0aee28b5ca1a328d5df8596b935.tar.bz2
fix(input): fix the email regex to accept TLDs up to 6 characters long
The input field email regex does't not match long domain extensions. This commit extends the email regexp to take a 6 character TLD. Example 6-character TLDs include .museum and .travel - (e.g. allabout.travel).
-rw-r--r--src/ng/directive/input.js2
-rw-r--r--test/ng/directive/inputSpec.js1
2 files changed, 2 insertions, 1 deletions
diff --git a/src/ng/directive/input.js b/src/ng/directive/input.js
index b19e005f..74c1bb4e 100644
--- a/src/ng/directive/input.js
+++ b/src/ng/directive/input.js
@@ -1,7 +1,7 @@
'use strict';
var URL_REGEXP = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/;
-var EMAIL_REGEXP = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/;
+var EMAIL_REGEXP = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}$/;
var NUMBER_REGEXP = /^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/;
var inputType = {
diff --git a/test/ng/directive/inputSpec.js b/test/ng/directive/inputSpec.js
index d800bf92..d65f2d37 100644
--- a/test/ng/directive/inputSpec.js
+++ b/test/ng/directive/inputSpec.js
@@ -716,6 +716,7 @@ describe('input', function() {
it('should validate email', function() {
expect(EMAIL_REGEXP.test('a@b.com')).toBe(true);
+ expect(EMAIL_REGEXP.test('a@b.museum')).toBe(true);
expect(EMAIL_REGEXP.test('a@B.c')).toBe(false);
});
});