Regular Expressions
Regular Expressions
I am trying to match a form field value to a regular expression, to validate an e-mail address on the client side. It doesn't work (I come from Prototype) and for the life of me, can't figure out why.
-
$('input#email').blur(function(){
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if($('input#email').val() == filter){
$('span#email_good').show();
$('span#email_odd').hide();
} else{
$('span#email_odd').show();
$('span#email_good').hide();
}
});