123456反对反对fffdf1313   =>13  13
abcdef  fdfac   =>ac

解决方案 »

  1.   

    捕获一位和第三位的字符  测试反向引用的
    (g)lkklk(k)(\1\2)
      

  2.   

    1h2kokkokoijugu几乎,llhu好好12
    12被捕获
      

  3.   

    (?<=(?<f>.).(?<s>.).*)\k<f>\k<s>
      

  4.   

    (?<=(?<f>.).(?<s>.).*)\k<f>\k<s>
    为什么要在外层加一个()?
      

  5.   

     static void Main()
            {
                string str = "abcedf";
                Regex re = new Regex(@"(?<ch1>\w)\w(?<ch2>\w).*?");
                string expect = re.Match(str).Groups["ch1"].Value + re.Match(str).Groups["ch2"].Value;
                string[] strarr = new string[] {"ac","acd","add" };
                foreach (string s in strarr)
                {
                    if(s==expect)
                    Console.WriteLine(s);
                }        }这样?
      

  6.   

    (?<=exp) 匹配exp后面的位置    第一个是(? <f>.)   第2个是. 第3个是(? <s>.)  后面n多是.*si写错了吧
      

  7.   


    这个外层的括号是跟(?<=xxx)组合的,匹配前面是xxx的位置(但不匹配xxx的文本),没有?<=的语法,不带括号就变成3个符号了
      

  8.   

    看客客的blog之前可以看看这个
      

  9.   

    (.).(.).*?\1\2   粗糙
    code(? <=(? <f>.).(? <s>.).*)\k <f>\k <s> 精华
      

  10.   

    客客的这样就满足要求了
    (?<=(.).(.)).*?(?<target>\1\2)