using System;
using System.Text.RegularExpressions;
public class Test
{
public static void Main()
{
var text = @"
test
test
hello
";
Regex rx = new Regex("<([^>\n]*)>(.*?)(\\1)>");
var m = rx.Match(text);
while (m.Success) {
Console.WriteLine("{0}='{1}'", m.Groups[1], m.Groups[2]);
m = m.NextMatch();
}
}
}