又正则卡壳了求帮助 本帖最后由 gaowenzhen 于 2010-12-12 13:17:10 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 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);仅供参考。。 【急求】: 12小时制, 1:20分,时针和分针的夹角是多少?? ----------C#写的QQ群发器的问题------------------ 一个比较偏的问题,关于与工控软件通讯的 各位大哥大姐,我现在要做一个交叉的分析报表,就是需要交叉的项目有多项,就是数量、金额及金额比率,请问一下,能否在一张表内反映出来 vs2005下用CrystalReport的问题 calendar 关于关闭窗体的问题 为什么发邮件要把密码给微软呢? C#中如何调用API?谁有比较好的例子? 繼續剛才的問題﹐難道是bug不成。。 如何统计数字出现的个数? 帮帮忙,在线等
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);
仅供参考。。