how to check string contain emailid or not?
-
07-07-2019 - |
Question
i m looking for checking emailid in content of message body. i do not want to allow any one to send message that contain email address as a part of message.
so how can i achieve this in asp.net c#??
Please help me if any one has an idea about this !!!
Solution
Regex re = new Regex(@"[A-Za-z0-9_\-\.]+@([A-Za-z0-9\-]+\.)+([A-Za-z\-])+");
MatchCollection matches = re.Matches(Text);
foreach (Match s in matches)
{//do whatever with s.Value}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow