Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit af73135

Browse files
neilmcgibbonmatsko
neilmcgibbon
authored andcommitted
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).
1 parent a02aaf1 commit af73135

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/ng/directive/input.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
var URL_REGEXP = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/;
4-
var EMAIL_REGEXP = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/;
4+
var EMAIL_REGEXP = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}$/;
55
var NUMBER_REGEXP = /^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/;
66

77
var inputType = {

test/ng/directive/inputSpec.js

+1
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,7 @@ describe('input', function() {
748748

749749
it('should validate email', function() {
750750
expect(EMAIL_REGEXP.test('a@b.com')).toBe(true);
751+
expect(EMAIL_REGEXP.test('a@b.museum')).toBe(true);
751752
expect(EMAIL_REGEXP.test('a@B.c')).toBe(false);
752753
});
753754
});

0 commit comments

Comments
 (0)