string input = "Hello world! Hello!"; string regex = "(?<1>ll)"; for (Match m = Regex.Match(input, regex); m.Success; m = m.NextMatch()) { Console.WriteLine(m.Groups[1].Index + ": " + m.Groups[1]); }
string input = "[link=\"http://blog.cumps.be/starting-exam-70-536-study/\"]Starting Exam 70-536 Study[/link]"; string regex = @"\[link=""(?<link>((.|\n)*?))""\](?<text>((.|\n)*?))\[\/link\]"; Console.WriteLine(Regex.Match(input, regex).Result("${text}: ${link}"));