本帖最后由 gaowenzhen 于 2010-12-12 13:17:10 编辑

解决方案 »

  1.   

                string s = "<td class=\"text\"><a href=\"http://forex.hexun.com/2010-12-12/126132245.html \" mon=\"a=5&pn=1\" target=_blank><span><b><font color=\"#C60A00\">这里</font>我只要<font color=\"#C60A00\">取出文本</font>不要html标记和...其他都要</b></span></a> <font color=#6f6f6f> <nobr>和讯网 2010-12-12 12:25</nobr></font><br>这里取出文本<font size=-1>(PBOC)前副行长吴晓灵周六(12月11日)表示,由于存在吸引资金流入从而引发进一步通胀的风险,<font color=\"#C60A00\">中国</font>无法实施加息政策。 吴晓灵表示,全球低利率环境令<font color=\"#C60A00\">中国</font>人民银行无法实施升息政策。新兴市场国家面临着资本流入的风险,而货币供应过度是<font color=\"#C60A00\">中国</font>通货膨胀的重要原因之一。 她并称,...</font></td>";
                string pattern = "<td[^>]*>\\s*<a href=\"([^\"]*)\"[^>]*>(<span>[\\s\\S]*?</span>)</a>\\s*(<font[^>]*>[\\s\\S]*?</font>)([\\s\\S]*?)</td>";
                Match m = Regex.Match(s, pattern, RegexOptions.IgnoreCase);
                string url = m.Groups[1].Value;
                string title = Regex.Replace(m.Groups[2].Value, "<[^>]*>", "");
                string time = Regex.Match(m.Groups[3].Value, @"\d{4}-\d{1,2}-\d{1,2}\s+\d{1,2}:\d{1,2}").Value;
                string content = Regex.Replace(m.Groups[4].Value, "<[^>]*>", "");
                Console.WriteLine("{0}\n{1}\n{2}\n{3}", url, title, time, content);
    仅供参考。。