C# 正则表达式  获取 class="css10" 的tr 的第5个td的文本值。没学过正则 不知道怎么写。

解决方案 »

  1.   

    Match matchTr = Regex.Match(html,
                        @"<tr class=""css10"">(.+?)</tr>",
                    RegexOptions.Singleline | RegexOptions.IgnoreCase);MatchCollection matcheTd = Regex.Matches(
                        matchTr.Value,
                        @"<td(?:.*?)>(.+?)</td>",
                        RegexOptions.Singleline | RegexOptions.IgnoreCase);matcheTd[5].Groups[1].Value;
                        
      

  2.   

    http://deerchao.net/tutorials/regex/regex.htm
      

  3.   

    上代码先MatchCollection mces = Regex.Matches(html,@"(?is)<tr[^>]*?class=""css10""[^>]*?>(.*?)</tr>");
    foreach(Match mc in mces)
    {
    string strResult = Regex.Matches(mc.Value,@"(?is)<td[^>]*?>(.*?)</td>")[4].Value;
    }