Definitely you need to use
Ragex
pattern matching with that.
consider this Email
Regex
pattern.
[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}
take a look at my sample.
ArrayList list = new ArrayList();
string TestString = "From: Mabel Garcia <mabel@flossresearch.com> From: Mabel Garcia <mabel@flossresearch.com> From: mabel@flossresearch.com From: mabel@flossresearch.com (Mabel Garcia)";
string regexPattern = @"[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}";
Regex regex = new Regex(regexPattern);
foreach(Match match in regex.Matches(TestString))
{
if (!list.Contains(match.Value))
list.Add(match.Value);
}
Please
vote and
Accept Answer if it Helped.