I find that jQuery validation plugin regex to be insufficient for my requirement. It accepts any email address xxx@hotmail.x as a valid email address whereas I want to be able to supply this regex /^([a-zA-Z0-9_.-+])+\@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/ so that it would validate complete .com part of the address. I'm more concerned about being able to supply my own regex than getting a fool proof regex(as there is no fool proof regex for email validation)
Just FYI: I'm also doing server side validation but at this point I'm not worried about which email address regex is right.
Is there a way to do that within the "rules" section of jQuery validate plugin?
This is my rules section right now:
rules: {
email: {
required: {
depends:function(){
$(this).val($.trim($(this).val()));
return true;
}
},
email: true
},