I have a requirement to validate an email address entered when a user comes out from the textbox.
I have googled for this but I got form validation JScript; I don\'t wa
If you wish to allow accent (see RFC 5322) and allow new domain extension like .quebec. use this expression:
/\b[a-zA-Z0-9\u00C0-\u017F._%+-]+@[a-zA-Z0-9\u00C0-\u017F.-]+\.[a-zA-Z]{2,}\b/
Based on this article
JsFidler
$(document).ready(function() {
var input = $('.input_field');
var result = $('.test_result');
var regExpression = /\b[a-zA-Z0-9\u00C0-\u017F._%+-]+@[a-zA-Z0-9\u00C0-\u017F.-]+\.[a-zA-Z]{2,}\b/;
$('.btnTest').click(function(){
var isValid = regExpression.test(input.val());
if (isValid)
result.html('This email is valid');
else
result.html('This email is not valid');
});
});
body {
padding: 40px;
}
label {
font-weight: bold;
}
input[type=text] {
width: 20em
}
.test_result {
font-size:4em;
}
Not Tested