Function to check the given text and regex pattern is match or not.
public static bool IsMatch(string text, string pattern)
text = text.Trim();
Match mc = Regex.Match(text, pattern);
bool isMatch = (mc.Success && (mc.Value == text));
mc = null;
string pattern = @"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*";
bool isMatch = IsMatch("[email protected]", pattern);
You need to import following line of code at the top of your class.
Just a normal software developer who love to write code. Developing professional software since 1999. After working in the software industry for many years, I've started my own website to share knowledges and experiences.