Posts

Showing posts from April, 2020

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; } }