分析一个字符串中以<>标签括起来的内容。
如:<Hello><,><World> 可以得到Hello,World

解决方案 »

  1.   

      string str = "<Hello><,><World>";
                    Regex _reg = new Regex(@"(?<=<)[^>]+?(?=>)");
                    Match m=_reg.Match(str);
                    string s = string.Join("",_reg.Matches(str).Cast<Match>().Select(a=>a.Value).ToArray());//
                    //Hello,World
      

  2.   

    上述2个方法对于<>中是空内容好像都没有获得啊,该怎么写?