string str email avasfish mail ru бла бла Regex regex new Regex email

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
string str = "email : avasfish@mail.ru бла бла";
Regex regex = new Regex(@"email : ([\w.@]+)", RegexOptions.IgnoreCase);
regex.GetGroupNames();
MatchCollection matches = regex.Matches(str);
foreach (Match match in matches)
{
GroupCollection groups = match.Groups;
Console.WriteLine("значение '{0}' позиция {1}",
groups[1].Value,
groups[1].Index);
}
Console.WriteLine();
Console.ReadLine();