I'm not going to reinvent the wheel. so after surfing google, (not that much expert in regx stuff) i found below function.
function emailPatternCheck(input){
var email= /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
return email.test(input);
}
it's supposed to return false for emailPatternCheck('example123@demo.com.com.com') . but getting true.
Could some tell me where should do modification to avoid .com.com.com
Sample input
emailPatternCheck('example123@demo.com') // true, expected
emailPatternCheck('ex_123@demo.com') // true, expected
emailPatternCheck('ex-123@demo.com') // true, expected
emailPatternCheck('#$%#$@demo.com') // false, expected
emailPatternCheck('example@@@asdf.com') // false, expected
emailPatternCheck('example@$%#%.com') // false, expected
emailPatternCheck('example123@demo.com.com.com') should be false not true
Thanks