1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
/// <summary>
/// Gets all Email addresses.
/// </summary>
/// <param name="text">The text.</param>
/// <returns></returns>
private static List<string> GetAllEMailAddresses(string text)
{
List<string> result = new List<string>();
System.Text.RegularExpressions.MatchCollection regexMatchCollection = System.Text.RegularExpressions.Regex.Matches(text, @"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*");
for (int i = 0; i < regexMatchCollection.Count; i++)
if (!result.Contains(regexMatchCollection[i].Value))
result.Add(regexMatchCollection[i].Value);
return result;
}
|