JQuery : Simple Regular expression for Email validation

Email validation is always required when we have a form or login / sign up pages. If we are using JQuery, the below regular expression will be simple and easy to use for validating an email address.


Testemail = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/i;


So we can write this in a function :



function TestValidEmail(sEmail) { var Testemail = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/i; if (Testemail .test(sEmail)) { return true; } else { return false; } }



Comments

Popular posts from this blog

how to add new line in google form questions | Fix for next line issue in google form questions

How to add new line in dropdown type question in google forms