Wednesday, March 24, 2010

Validate Email ID


function IsEmailValid(string)
{
    if(!IsNull(string))
    {
     var regex = new RegExp('^[\\w-_%\.]*[\\w-_%\.]\@[\\w]\
.+[\\w]+[\\w]$');
        return regex.test(string);
    }
    
    return false;
}

function IsNull(val)
{
    return (val == null || val == '');
}