Skip to content

Commit 8317071

Browse files
mansonchor.github.comdead-horse
authored andcommitted
fix: email regx to case insensitive (#36)
1 parent def7522 commit 8317071

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var DATETIME_TYPE_RE = /^\d{4}\-\d{2}\-\d{2} \d{2}:\d{2}:\d{2}$/;
1111
var ID_RE = /^\d+$/;
1212

1313
// http://www.regular-expressions.info/email.html
14-
var EMAIL_RE = /^[a-z0-9\!\#\$\%\&\'\*\+\/\=\?\^\_\`\{\|\}\~\-]+(?:\.[a-z0-9\!\#\$\%\&\'\*\+\/\=\?\^\_\`\{\|\}\~\-]+)*@(?:[a-z0-9](?:[a-z0-9\-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9\-]*[a-z0-9])?$/;
14+
var EMAIL_RE = /^[a-z0-9\!\#\$\%\&\'\*\+\/\=\?\^\_\`\{\|\}\~\-]+(?:\.[a-z0-9\!\#\$\%\&\'\*\+\/\=\?\^\_\`\{\|\}\~\-]+)*@(?:[a-z0-9](?:[a-z0-9\-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9\-]*[a-z0-9])?$/i;
1515

1616
var PASSWORD_RE = /^[\w\`\~\!\@\#\$\%\^\&\*\(\)\-\_\=\+\[\]\{\}\|\;\:\'\"\,\<\.\>\/\?]+$/;
1717

test/index.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ describe('parameter', function () {
303303
'dead-horse@qq.com',
304304
'fengmk2+github@gmail.com',
305305
'fengmk2@yahoo.com.cn',
306+
'Fengmk2@126.Com',
306307
].forEach(function (email) {
307308
should.not.exist(parameter.validate({ name: 'email' }, { name: email }));
308309
should.not.exist(parameter.validate({ name: { type: 'email' } }, { name: email }));

0 commit comments

Comments
 (0)