视频管理员<video>;文库管理员<wenku>;新闻--管理员<news>
提取<>中的值,并且存入到字符串数组,请问该怎么写,谢谢

解决方案 »

  1.   

    [<].*?[>]
    遍历这个就行MatchCollection,添加到你的数组
      

  2.   

    string[] result=Regex.Mathces(str,"(?<=<)[^>]+(?=>)").Cast<Match).Select(x=>x.Value).ToArray();
      

  3.   

    string[] result=Regex.Matches(str,"(?<=<)[^>]+(?=>)").Cast<Match>.Select(x=>x.Value).ToArray();
      

  4.   


    Cast<Match> 这下边出现红色的波浪线错误 15 “System.Linq.Queryable.Cast<TResult>(System.Linq.IQueryable)”是一个“方法”,这在给定的上下文中无效 F:\win2008iis\BYVOD\Controllers\MailController.cs 30 85 BYVOD
      

  5.   

    string[] result=Regex.Matches(str,"(?<=<)[^>]+(?=>)").Cast<Match>().Select(x=>x.Value).ToArray();
    Cast<Match>后边加 () 就好了,非常感谢!!