jqBootstrapValidation icon indicating copy to clipboard operation
jqBootstrapValidation copied to clipboard

Need to modify regex for email checking

Open garima-agal opened this issue 10 years ago • 3 comments

Email validation restricts the no of characters after dot(.) to be maximum of four only.

Current regex:- [a-zA-Z0-9.!#$%&\u2019*+/=?^_`{|}~-]+@[A-Za-z0-9.-]+.[A-Za-z]{2,4}

But there are email addresses that have more than 4 characters. For example:- [email protected] [email protected]

So, validation gets fail. Need to increase the character size after dot.

garima-agal avatar Feb 26 '15 06:02 garima-agal

You can override the default function to workaround.

$.jqBootstrapValidation('override', {
    builtInValidators: {
        validemail: {
            name: 'Validemail',
            type: 'regex',
            regex: '[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\\.[A-Za-z]{2,6}',
            message: 'Not a valid email address'
        }
    }
});

guipacheco2 avatar Jul 27 '15 14:07 guipacheco2

Yes, I did that but it should be fixed in the core rather than overriding....

garima-agal avatar Jul 28 '15 05:07 garima-agal

Please create new regex for the core following the standard:

https://tools.ietf.org/html/rfc3696

ghost avatar Apr 29 '17 09:04 ghost