本帖最后由 jiewei915 于 2011-01-07 17:10:36 编辑

解决方案 »

  1.   


    void Main()
    {
    string html=@"<td width=""50%"">
    <b><a href=""/browse/A"">嵌入式平台</a></b>
    <font size=1>(ARM)</font>
    </td>

    <td width=""50%"">
    <b><a href=""/browse/B"">中国</a></b>
    <font size=1>(CHINA)</font>
    </td>

    <td width=""50%"">
    <b><a href=""/browse/C"">美国</a></b>
    <font size=1>(America)</font>
    </td>";

    foreach(Match m in Regex.Matches(html,@"(?is)<a[^>]+>([^<>]+)</a>.*?<font[^>]+>([^<>]+)</font>"))
    {
     Console.WriteLine(m.Groups[1].Value);
     Console.WriteLine(m.Groups[2].Value);
    }

    /*
    嵌入式平台
    (ARM)
    中国
    (CHINA)
    美国
    (America) */
    }
      

  2.   

    >([^<>]+)<
    可以这样 
      

  3.   

     foreach (Match m in Regex.Matches(html, @"(?<=(>))(\w+)(?=(</a>))|(?<=(>))(.+)(?=(</font>))"))
                    {
                        Console.WriteLine(m.Value);
                    }
      

  4.   


    void Main()
    {
    string html=@"<td width=""50%"">
    <b><a href=""/browse/A"">嵌入式平台</a></b>
    <font size=1>(ARM)</font>
    </td>

    <td width=""50%"">
    <b><a href=""/browse/B"">中国</a></b>
    <font size=1>(CHINA)</font>
    </td>

    <td width=""50%"">
    <b><a href=""/browse/C"">美国</a></b>
    <font size=1>(America)</font>
    </td>";

    foreach(Match m in Regex.Matches(html,@">([^<>\s]+)<"))
    {
     Console.WriteLine(m.Groups[1].Value); 
    }

    /*
    嵌入式平台
    (ARM)
    中国
    (CHINA)
    美国
    (America) 
    */
    }