diff options
| author | neilmcgibbon | 2013-08-02 14:57:58 +0100 | 
|---|---|---|
| committer | Matias Niemelä | 2013-08-07 14:02:44 -0400 | 
| commit | af731354b0b600f87f15e1573e64a7f7acc70f3d (patch) | |
| tree | 8999558fbb9f985c2726d1bbc50c843eefb9ab04 | |
| parent | a02aaf17098006f3bf088e2b6a39b96b8b0736a9 (diff) | |
| download | angular.js-af731354b0b600f87f15e1573e64a7f7acc70f3d.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.js | 2 | ||||
| -rw-r--r-- | test/ng/directive/inputSpec.js | 1 | 
2 files changed, 2 insertions, 1 deletions
| diff --git a/src/ng/directive/input.js b/src/ng/directive/input.js index af028fd5..f5d30a3e 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 36fb754d..8f18964e 100644 --- a/test/ng/directive/inputSpec.js +++ b/test/ng/directive/inputSpec.js @@ -748,6 +748,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);        });      }); | 
