研究了半天,终于基本上明白了这个 /num的意思和用法, 查找与第num个"()"中的正则表达式相匹配的两个一样的值, 只有两个,
String s = "is is the cost of of gasoline going up up";
//String regex ="(\\d+)(\\w+)\\1";
String regex = "\\b([a-z]+) \\1\\b"; // \1代表第1 个()中的内容 , 这个 \\1 前面还有空格
foreach (Match m in Regex.Matches(s, regex))
{
Console.WriteLine(m.Value);
}
output: is is of of up up