can i use same regex in c# that i have used in javascript
private static bool IsValidEmail(string senderEmail) { var regExPattern_forEmail = new Regex(@"^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$"); return (string.IsNullOrEmpty(senderEmail) != true && regExPattern_forEmail.IsMatch(senderEmail) != true); }
function validateEmail(objEmail) { var regExPattern_forEmail = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/; if (regExPattern_forEmail.test(objEmail.value) == false) { alert('\"' + objEmail.value + '\" is INVALID e-mail Address'); return false; } else { alert('\"' + objEmail.value + '\" is VALID e-mail Address'); return true; } }
Regex regex = new Regex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$");
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)