<caption>11年04月01日</caption>
<tr><th rowspan="2" width="50">联赛</th>
<th rowspan="2" width="50">时间</th>
<th rowspan="2">比赛对阵</th>
<th colspan="3" width="190">亚洲盘口</th>
<th colspan="3" width="105">全场标盘</th>
<th colspan="3" width="105">上半场标盘</th>
<th colspan="3" width="105">大小球</th>
<th rowspan="2" width="40">比<br/>分</th>
<th rowspan="2" width="40">盘<br/>路</th>
<th rowspan="2" width="40">变<br/>盘</th></tr>
<tr><th width="45"><em>贴水</em></th><th width="100"><em>让球</em></th><th width="45"><em>贴水</em></th>
<th width="35"><em>胜</em></th><th width="35"><em>平</em></th><th width="35"><em>负</em></th>
<th width="35"><em>胜</em></th><th width="35"><em>平</em></th><th width="35"><em>负</em></th>
<th width="35"><em>大</em></th><th width="35"><em>界限</em></th><th width="35"><em>小</em></th></tr>
<tr><td style="background-color:#006633"><strong style="color:#FFFFFF">巴杯</strong></td>
<td>06:30</td>
<td><b>邦迪比达vs戈亚斯</b></td>
<td>1.77</strong>&nbsp;</td><td>平手/半球&nbsp;</td><td>1.99</strong>&nbsp;</td><td>1.95</strong>&nbsp;</td><td>3.25</strong>&nbsp;</td><td>3.37</strong>&nbsp;</td><td>2.65&nbsp;</td><td>2.05&nbsp;</td><td>3.75&nbsp;</td><td>1.7&nbsp;</td><td>2.5&nbsp;</td><td>2&nbsp;</td> 
  
<td>0-3</td><td><a href="list.php?id=128127" target="_blank">盘路</a></td>
<td><a href="javascript:void(0);oc_menu('hiddendata_1')"><img src="images/aopan_hz_011.gif" width="29" height="19" alt=""/></a>&nbsp;</td>
</tr>
<tbody id="hiddendata_1" style="display:none;">
<tr><td colspan="2" rowspan="3">&nbsp;</td><td>04-01 04:00</td><td><strong style="color:#006600;">1.77</strong>&nbsp;</td><td>平手/半球&nbsp;</td><td><strong style="color:#006600;">1.99</strong>&nbsp;</td><td><strong style="color:#006600;">1.95</strong>&nbsp;</td><td><strong style="color:#006600;">3.25</strong>&nbsp;</td><td><strong style="color:#FF0000;">3.37</strong>&nbsp;</td><td>2.65&nbsp;</td><td>2.05&nbsp;</td><td>3.75&nbsp;</td><td>1.7&nbsp;</td><td>-</td><td>2&nbsp;</td><td colspan="3" rowspan="3"><a href="javascript:void(0);oc_menu('hiddendata_1')"><img src="images/aopan_hz_014.gif" width="95" height="21" alt=""/></a></td></tr><td>03-31 21:10</td><td><strong style="color:#FF0000;">1.77</strong>&nbsp;</td><td>平手/半球&nbsp;</td><td><strong style="color:#006600;">1.99</strong>&nbsp;</td><td>2.05&nbsp;</td><td>3.25&nbsp;</td><td>3.1&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>-</td><td>&nbsp;</td></tr><td>03-29 21:30</td><td>1.75&nbsp;</td><td>平手/半球&nbsp;</td><td>2.01&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>-</td><td>&nbsp;</td></tr>   
 </tbody> <tr><td style="background-color:#006633"><strong style="color:#FFFFFF">巴杯</strong></td>
<td>[07:00</td>
<td><b>普丹迪vs明尼路</b></td>
<td>1.84</strong>&nbsp;</td><td>受半球/一球&nbsp;</td><td>1.92</strong>&nbsp;</td><td>4.45</strong>&nbsp;</td><td>3.5</strong>&nbsp;</td><td>1.65</strong>&nbsp;</td><td>3.65&nbsp;</td><td>2.15&nbsp;</td><td>2.5&nbsp;</td><td>1.7&nbsp;</td><td>2.75&nbsp;</td><td>2&nbsp;</td> 
  
<td>2-1</td><td><a href="list.php?id=128116" target="_blank">盘路</a></td>
<td><a href="javascript:void(0);oc_menu('hiddendata_2')"><img src="images/aopan_hz_011.gif" width="29" height="19" alt=""/></a>&nbsp;</td>
</tr>

解决方案 »

  1.   

    你的数据好像有问题:试一下这个:
    static void Main(string[] args)
    {
        string html=@"";
        MatchCollection mc = Regex.Matches(html, @"<td>\[?(?<t>\d{2}:\d{2})</td>\s+<td><b>(?<vs>[^<]+)</b></td>\s+<td>(?<y>[.\d]+)</strong>");
        foreach (Match m in mc)
        {
            Console.WriteLine(m.Groups["t"].Value);
            Console.WriteLine(m.Groups["vs"].Value);
            Console.WriteLine(m.Groups["y"].Value);
            Console.WriteLine("=====================");
        }
    }
      

  2.   

    我好像以前是 用xml读取出来的,你这用表格读取的,好麻烦哦!在说,你查找的话,直接拼接sql语句不行吗???
      

  3.   

    http://odds.sports.sina.com.cn/odds/我想抓取上面这个地址显示出的历史数据,保存包本地
      

  4.   


                string result = "";
                string html = @"<caption>11年04月01日</caption>
    <tr><th rowspan='2' width='50'>联赛</th>
    <th rowspan='2' width='50'>时间</th>
    <th rowspan='2'>比赛对阵</th>
    <th colspan='3' width='190'>亚洲盘口</th>
    <th colspan='3' width='105'>全场标盘</th>
    <th colspan='3' width='105'>上半场标盘</th>
    <th colspan='3' width='105'>大小球</th>
    <th rowspan='2' width='40'>比<br/>分</th>
    <th rowspan='2' width='40'>盘<br/>路</th>
    <th rowspan='2' width='40'>变<br/>盘</th></tr>
    <tr><th width='45'><em>贴水</em></th><th width='100'><em>让球</em></th><th width='45'><em>贴水</em></th>
    <th width='35'><em>胜</em></th><th width='35'><em>平</em></th><th width='35'><em>负</em></th>
    <th width='35'><em>胜</em></th><th width='35'><em>平</em></th><th width='35'><em>负</em></th>
    <th width='35'><em>大</em></th><th width='35'><em>界限</em></th><th width='35'><em>小</em></th></tr>
    <tr><td style='background-color:#006633'><strong style='color:#FFFFFF'>巴杯</strong></td>
    <td>06:30</td>
    <td><b>邦迪比达vs戈亚斯</b></td>
    <td>1.77</strong>&nbsp;</td><td>平手/半球&nbsp;</td><td>1.99</strong>&nbsp;</td><td>1.95</strong>&nbsp;</td><td>3.25</strong>&nbsp;</td><td>3.37</strong>&nbsp;</td><td>2.65&nbsp;</td><td>2.05&nbsp;</td><td>3.75&nbsp;</td><td>1.7&nbsp;</td><td>2.5&nbsp;</td><td>2&nbsp;</td>  
      
    <td>0-3</td><td><a href='list.php?id=128127' target='_blank'>盘路</a></td>
    <td><a href='javascript:void(0);oc_menu('hiddendata_1')'><img src='images/aopan_hz_011.gif' width='29' height='19' alt=''/></a>&nbsp;</td>
    </tr>
    <tbody id='hiddendata_1' style='display:none;'>
    <tr><td colspan='2' rowspan='3'>&nbsp;</td><td>04-01 04:00</td><td><strong style='color:#006600;'>1.77</strong>&nbsp;</td><td>平手/半球&nbsp;</td><td><strong style='color:#006600;'>1.99</strong>&nbsp;</td><td><strong style='color:#006600;'>1.95</strong>&nbsp;</td><td><strong style='color:#006600;'>3.25</strong>&nbsp;</td><td><strong style='color:#FF0000;'>3.37</strong>&nbsp;</td><td>2.65&nbsp;</td><td>2.05&nbsp;</td><td>3.75&nbsp;</td><td>1.7&nbsp;</td><td>-</td><td>2&nbsp;</td><td colspan='3' rowspan='3'><a href='javascript:void(0);oc_menu('hiddendata_1')'><img src='images/aopan_hz_014.gif' width='95' height='21' alt=''/></a></td></tr><td>03-31 21:10</td><td><strong style='color:#FF0000;'>1.77</strong>&nbsp;</td><td>平手/半球&nbsp;</td><td><strong style='color:#006600;'>1.99</strong>&nbsp;</td><td>2.05&nbsp;</td><td>3.25&nbsp;</td><td>3.1&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>-</td><td>&nbsp;</td></tr><td>03-29 21:30</td><td>1.75&nbsp;</td><td>平手/半球&nbsp;</td><td>2.01&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>-</td><td>&nbsp;</td></tr>   
    </tbody> <tr><td style='background-color:#006633'><strong style='color:#FFFFFF'>巴杯</strong></td>
    <td>[07:00</td>
    <td><b>普丹迪vs明尼路</b></td>
    <td>1.84</strong>&nbsp;</td><td>受半球/一球&nbsp;</td><td>1.92</strong>&nbsp;</td><td>4.45</strong>&nbsp;</td><td>3.5</strong>&nbsp;</td><td>1.65</strong>&nbsp;</td><td>3.65&nbsp;</td><td>2.15&nbsp;</td><td>2.5&nbsp;</td><td>1.7&nbsp;</td><td>2.75&nbsp;</td><td>2&nbsp;</td>  
      
    <td>2-1</td><td><a href='list.php?id=128116' target='_blank'>盘路</a></td>
    <td><a href='javascript:void(0);oc_menu('hiddendata_2')'><img src='images/aopan_hz_011.gif' width='29' height='19' alt=''/></a>&nbsp;</td>
    </tr>";
                string pattern = @"<td.*?>(.*?)</td>\s*<td.*?><b>(.*?)</b></td>\s*<td>(.*?)</strong>.*?</td><td.*?>(.*?)&nbsp;</td><td.*?>(.*?)</strong>.*?</td><td.*?>(.*?)</strong>.*?</td><td.*?>(.*?)</strong>.*?</td><td.*?>(.*?)</strong>.*?</td><td.*?>(.*?).*?</td><td.*?>(.*?)&nbsp;</td><td.*?>(.*?)&nbsp;</td><td.*?>(.*?)&nbsp;</td><td.*?>(.*?)&nbsp;</td><td.*?>(.*?)&nbsp;</td>";
                MatchCollection mc = Regex.Matches(html, pattern, RegexOptions.IgnoreCase);
                for (int i = 0; i < mc.Count; i++)
                {
                    for (int j = 1; j < mc[i].Groups.Count; j++)
                    {
                        result += mc[i].Groups[j].Value + "   ";
                    }
                    result += "\r\n";
                }//result就是最后的结果
      

  5.   

    sunny906, 验证不通过 ,show出来没有东西
      

  6.   

    虽然你的数据有点小错,但我2楼的已经可以正常工作(楼主没试?)根据你的网址,又进行简单修改,效果良好
    static void Main(string[] args)
    {
        string html=@"";
        MatchCollection mc = Regex.Matches(html, @"<td>(?<t>\d{2}:\d{2})</td>\s+<td><b>(?<vs>[^<]+)</b></td>\s+<td>(?<y>[.\d]+)</strong>");
        foreach (Match m in mc)
        {
            Console.WriteLine(m.Groups["t"].Value);
            Console.WriteLine(m.Groups["vs"].Value);
            Console.WriteLine(m.Groups["y"].Value);
            Console.WriteLine("=====================");
        }
    }
      

  7.   

    帮你给个测试字符串吧:string html=@"
    ...
    <td>01:00</td>
    <td><b>马德里竞技vs勒万特</b></td>
    <td>1.98</strong>&nbsp;</td><td>一球&nbsp;</td><td>1.88</strong>&nbsp;</td><td>1.45</strong>&nbsp;</td><td>3.9</strong>&nbsp;</td><td>6.1</strong>&nbsp;</td><td>2.1&nbsp;</td><td>2.2&nbsp;</td><td>4.85&nbsp;</td><td>2.2&nbsp;</td><td>3&nbsp;</td><td>1.6&nbsp;</td> 
      
    <td>4-1</td><td><a href=""list.php?id=121270"" target=""_blank"">盘路</a></td>
    <td><a href=""javascript:void(0);oc_menu('hiddendata_1')""><img src=""images/aopan_hz_011.gif"" width=""29"" height=""19"" alt=""""/></a>&nbsp;</td>
    </tr>
    <tbody id=""hiddendata_1"" style=""display:none;"">
    <tr><td colspan=""2"" rowspan=""11"">&nbsp;</td><td>04-25 01:10</td><td><strong style=""color:#FF0000;"">1.98</strong>&nbsp;</td><td>一球&nbsp;</td><td><strong style=""color:#006600;"">1.88</strong>&nbsp;</td>
    <td>01:00</td>
    <td><b>沙兰迪兵工厂vs甘拿斯亚</b></td>
    <td>2.22</strong>&nbsp;</td><td>半球&nbsp;</td><td>1.6</strong>&nbsp;</td><td>2.1</strong>&nbsp;</td><td>3.22</strong>&nbsp;</td><td>3.03</strong>&nbsp;</td><td>2.75&nbsp;</td><td>1.9&nbsp;</td><td>3.95&nbsp;</td><td>1.9&nbsp;</td><td>2.25&nbsp;</td><td>1.8&nbsp;</td> 
      
    <td>1-1</td><td><a href=""list.php?id=125187"" target=""_blank"">盘路</a></td>
    <td><a href=""javascript:void(0);oc_menu('hiddendata_2')""><img src=""images/aopan_hz_011.gif"" width=""29"" height=""19"" alt=""""/></a>&nbsp;</td>
    </tr>
    <tbody id=""hiddendata_2"" style=""display:none;"">
    <tr><td colspan=""2"" rowspan=""4"">&nbsp;</td><td>04-25 00:50</td><td><strong style=""color:#FF0000;"">2.22</strong>&nbsp;</td><td>半球&nbsp;</td><td><strong style=""color:#006600;"">1.6</strong>&nbsp;</td><td><strong style=""color:#FF0000;"">2.1</strong>&nbsp;</td><td><strong style=""color:#006600;"">3.22</strong>&nbsp;</td><td><strong style=""color:#006600;"">3.03</strong>&nbsp;</td><td>2.75&nbsp;</td><td>1.9&nbsp;</td><td>3.95&nbsp;</td><td>1.9&nbsp;</td><td>-</td><td>1.8&nbsp;</td><td colspan=""3"" rowspan=""4""><a href=""javascript:void(0);oc_menu('hiddendata_2')""><img src=""images/aopan_hz_014.gif"" width=""95"" height=""21"" alt=""""/></a></td></tr><td>04-24 22:00</td><td><strong style=""color:#FF0000;"">2.17</strong>&nbsp;</td><td>半球&nbsp;</td><td><strong style=""color:#006600;"">1.65</strong>&nbsp;</td><td><strong style=""color:#FF0000;"">2</strong>&nbsp;</td><td><strong style=""color:#006600;"">3.22</strong>&nbsp;</td><td><strong style=""color:#006600;"">3.26</strong>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>-</td><td>&nbsp;</td></tr><td>04-24 21:30</td><td><strong style=""color:#FF0000;"">2.07</strong>&nbsp;</td><td>半球&nbsp;</td><td><strong style=""color:#006600;"">1.75</strong>&nbsp;</td><td>1.95&nbsp;</td><td>3.22&nbsp;</td><td>3.4&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>-</td><td>&nbsp;</td></tr><td>04-21 18:00</td><td>2.02&nbsp;</td><td>半球&nbsp;</td><td>1.8&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>-</td><td>&nbsp;</td></tr>   
     </tbody> <tr><td style=""background-color:#348017""><strong style=""color:#FFFFFF"">墨超</strong></td>
    <td>01:00</td>
    <td><b>莫雷利亚vs堤格雷斯</b></td>
    <td>2.01</strong>&nbsp;</td><td>平手/半球&nbsp;</td><td>1.75</strong>&nbsp;</td><td>2&nbsp;</td><td>3.2&nbsp;</td><td>3.22&nbsp;</td><td>2.65&nbsp;</td><td>2.05&nbsp;</td><td>3.65&nbsp;</td><td>1.95&nbsp;</td><td>2.5&nbsp;</td><td>1.75&nbsp;</td> 
      
    <td>0-3</td><td><a href=""list.php?id=125608"" target=""_blank"">盘路</a></td>
    <td><a href=""javascript:void(0);oc_menu('hiddendata_3')""><img src=""images/aopan_hz_011.gif"" width=""29"" height=""19"" alt=""""/></a>&nbsp;</td>
    </tr>
    <tbody id=""hiddendata_3"" style=""display:none;"">
    <tr><td colspan=""2"" rowspan=""2"">&nbsp;</td><td>04-25 00:40</td><td><strong style=""color:#006600;"">2.01</strong>&nbsp;</td><td>平手/半球<img src=""http://odds.sports.sina.com.cn/odds/images/li_02.gif"" width=""12"" height=""12"" alt=""""/>&nbsp;</td><td><strong style=""color:#FF0000;"">1.75</strong>&nbsp;</td><td>2&nbsp;</td><td>3.2&nbsp;</td><td>3.22&nbsp;</td><td>2.65&nbsp;</td><td>2.05&nbsp;</td><td>3.65&nbsp;</td><td>1.95&nbsp;</td><td>-</td><td>1.75&nbsp;</td><td colspan=""3"" rowspan=""2""><a href=""javascript:void(0);oc_menu('hiddendata_3')""><img src=""images/aopan_hz_014.gif"" width=""95"" height=""21"" alt=""""/></a></td></tr><td>04-23 17:10</td><td>2.06&nbsp;</td><td>半球&nbsp;</td><td>1.7&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>-</td><td>&nbsp;</td></tr>   
     </tbody> <tr><td style=""background-color:#348017""><strong style=""color:#FFFFFF"">墨超</strong></td>
    <td>01:00</td>
    <td><b>托卢卡vs达高斯</b></td>
    <td>1.64</strong>&nbsp;</td><td>半球/一球&nbsp;</td><td>2.12</strong>&nbsp;</td><td>1.52&nbsp;</td><td>3.5&nbsp;</td><td>5.55&nbsp;</td><td>2.05&nbsp;</td><td>2.2&nbsp;</td><td>5&nbsp;</td><td>1.7&nbsp;</td><td>2.5&nbsp;</td><td>2&nbsp;</td> 
    .....   
    "内容太多,粘贴不进来!
      

  8.   

    你把我的代码完全复制一份,result怎么会没有结果呢?