字符串:    [test:Join,{a,b,c,d}]第一个正则匹配  Join第二个正则匹配  a,b,c,d谢谢了~

解决方案 »

  1.   


    字符串是: [test:Join,{a;b;c;d}]    {}里面是分号
      

  2.   

    1. (?<=\[test:)\w*?(?=,)2. (?<=,{)[\s\S]*?(?=})
      

  3.   

     string str = "[test:Join,{a;b;c;d}] ";
                Regex reg = new Regex(@"\[(\w+):");
                Match mc = reg.Match(str);
                if (mc.Success)
                {
                    Response.Write(mc.Result("$1")+"<BR>");
                }
                reg = new Regex(@"\{?(\w)+[;\}]");
                MatchCollection mcs = reg.Matches(str);
                foreach (Match m in mcs)
                {
                    Response.Write(m.Result("$1") + "<BR>");
                }
      

  4.   

    1.
    (?<=:)[^,]+
    2.
    (?<={)[^}]+