ReactiveRaven / jqBootstrapValidation

A JQuery validation framework for bootstrap forms.
http://reactiveraven.github.io/jqBootstrapValidation
MIT License
1.35k stars 336 forks source link

Need to modify regex for email checking #176

Open garima-agal opened 9 years ago

garima-agal commented 9 years ago

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:- info@abc.global abc@abc.career

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

guipacheco2 commented 8 years ago

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'
        }
    }
});
garima-agal commented 8 years ago

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

ghost commented 7 years ago

Please create new regex for the core following the standard:

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