var myemail = 'test@yahoo.com' if (/@yahoo.coms*$/.test(myemail)) { console.log("it ends in @yahoo"); }