I'm currently working on my own validation, but I have one small problem. I can't get email validation to work. I have tried some different expressions, but can't get it to work. Maybe i did something wrong with the layout?
var email = $('.email');
function valemail(){
var filter = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
if (filter.test(email)){
return true;
} else {
return false;
}
}
$('#registerform').submit(function() {
if (valemail()) {
return true;
} else {
return false;
}
});
/[^@\s]+@[^@\s]+\.[^@\s]+/check. A more complex regex will either reject valid addresses or be so complex that it is unmaintainable, both not useful. Keep it simple. Check mail addresses by trying to send actual mail there.