日期:2014-05-19  浏览次数:20474 次

(正则表达式)过客 者正则表达式高手来帮忙解决下效率问题
类型:笔记本电脑,方法(ParseHtmls)               正则表达式解析(72556)           所用时间:   00:00:05.7500000,写日志的时间:2007-5-15   11:55:34
类型:笔记本电脑,方法(ParseHtmls)               正则表达式解析(72607)           所用时间:   00:00:07.0468750,写日志的时间:2007-5-15   11:56:06
类型:笔记本电脑,方法(ParseHtmls)               正则表达式解析(74500)           所用时间:   00:00:12.0468750,写日志的时间:2007-5-15   12:44:06
==============表达式内容     =================
Regex   regexx   =   new   Regex(@ " <td[^> ]*?> (\s*? <[^> ]*?> \s*?)*?(? <content> [^ <> ]*?)(\s*? <[^> ]*?> \s*?)*? </td> ",   RegexOptions.IgnoreCase   |   RegexOptions.Compiled);
                                                MatchCollection   mcc   =   regexx.Matches(htmlStr);
                                                StringBuilder   sb   =   new   StringBuilder();
                                                foreach   (Match   m   in   mcc)
                                                {
                                                        sb.Append(m.Groups[ "content "].Value.Trim()   +   "÷ ");
                                                }
                                                strR   =   sb.ToString().Remove(sb.ToString().Length   -   1,   1).Replace( "÷÷ ",   "÷ ");
===================================
==============解析内容(因为太长先发前部分)======
                  <TD     align= "right "   style= "padding-right:10px "> <img   src= "http://www.pconline.com.cn/product/images/200606_dian.gif "   width= "3 "   height= "5 "   align= "absmiddle ">   <a   href= "http://pdlib.pconline.com.cn/product/guest/cavil4Guest.jsp?productId=175286 "   target= "_blank "> <font   color= "FF8000 "> <b> 我要挑错 </b> </font> </a> </TD>                                                                     </TR>