mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-17 11:11:05 +00:00
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).
This commit is contained in:
parent
a02aaf1709
commit
af731354b0
2 changed files with 2 additions and 1 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var URL_REGEXP = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/;
|
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 NUMBER_REGEXP = /^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/;
|
||||||
|
|
||||||
var inputType = {
|
var inputType = {
|
||||||
|
|
|
||||||
|
|
@ -748,6 +748,7 @@ describe('input', function() {
|
||||||
|
|
||||||
it('should validate email', function() {
|
it('should validate email', function() {
|
||||||
expect(EMAIL_REGEXP.test('a@b.com')).toBe(true);
|
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);
|
expect(EMAIL_REGEXP.test('a@B.c')).toBe(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue