Validating Free/Domain specific Email Address using Regular Expression.

vishalneeraj-24503
Posted by vishalneeraj-24503 under JavaScript category on | Points: 40 | Views : 924
If we have specific domain address as gmail.com,yahoo.com,hotmail.com and so on. Then write below function:-

<script type =" text/javascript">
function validate_free_domain_email(obj)
{
var reg = /^([\w-\.]+@(?!gmail.com)(?!yahoo.com)(?!hotmail.com)([\w-]+\.)+[\w-]{2,4})?$/
if (reg.test(obj))
{
return true;
}
else
{
return false;
}
}
</script>

Comments or Responses

Login to post response