求一正则表达式具体如下: <div id="pagerInfo">884</div><div id="FDate" style="display:none">124566</div>把网页数据的div标记包括内容全部去掉,这样的正则该怎么写啊? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 string str = @"aaa<div id=""pagerInfo"">884</div><div id=""FDate"" style=""display:none"">124566</div>"; string result = Regex.Replace(str, @"<div[^>]*?>.*</div>", ""); string result = Regex.Replace(str, @"(?is)<div[^>]*?>.*</div>", ""); 哈哈,太感谢了问题刚才我没说清, <td class="downValue">-0.03%<span class="arrowCss">↓</span></td> <td>8折/-</td> <td class="FundNameLeft"> <div class="FD_FundOperationButton MarginLeft10"><a fundcode="000001" fundname="华夏成长" href="https://www.95599.cn/PersonalBank/startUpHtmlSessionAction.ebf?optype=2&amp;opcode=000001">申购</a></div> <div class="FD_FundOperationButton"><a fundcode="000001" fundname="华夏成长" href="http://www.abchina.com/cn/EBanking/Ebanklogin/PCustomerLogin/default.htm">定投</a></div> <div class="FD_FundAddAttention"><a href="#" class="attentions"> 关注 </a></div> </td>像这样的有嵌套的div能去掉吗? string str = @"<td class=""downValue"">-0.03%<span class=""arrowCss"">↓</span></td> <td>8折/-</td> <td class=""FundNameLeft""> <div class=""FD_FundOperationButton MarginLeft10""><a fundcode=""000001"" fundname=""华夏成长"" href=""https://www.95599.cn/PersonalBank/startUpHtmlSessionAction.ebf?optype=2&amp;opcode=000001"">申购</a></div> <div class=""FD_FundOperationButton"">aa<div>bb</div><a fundcode=""000001"" fundname=""华夏成长"" href=""http://www.abchina.com/cn/EBanking/Ebanklogin/PCustomerLogin/default.htm"">定投</a></div> <div class=""FD_FundAddAttention""><a href=""#"" class=""attentions""> 关注 </a></div> </td>"; string result = Regex.Replace(str, @"(?is)<div[^>]*?>.*</div>", ""); Console.WriteLine(result); 我想你是要这种效果吧: string str = "<!--start--><p><font face=\"Arial\">2009年7月2日下午,上海市胸科医院冯运院长、陈蓓副书记及医院职能科室负责人一行来我院进行交流考察。</font></p><p><font face=\"Arial\">我院陈农副院长接待了来宾并介绍了医院基本情况。双方在医院绩效考核、学科发展、人才培养以及医疗质量管理、成本核算等方面进行了深入探讨。</font></p><p><font face=\"Arial\">许武林副院长、洪朝阳副院长以及院办、党办、人事、医务、科教、财务等科室负责人交流时在座。</font></p><!--end-->"; string pattern = @"(?is)<[^>]*?>"; string strResult = Regex.Replace(str, pattern, ""); Console.WriteLine(strResult); Console.Read(); C#中,Microsoft.Office.Interop.Word.Document对象能否转化成二进制流? 有没高手?这咋整的?我这绑定每个数据出现了两次 vs2008安装问题,求大神门,我已经几天没解决了,心思痛苦中 ajax无刷新分页问题 关于串口serialprot控件的用法. 怎么让form不失去焦点? 求RGB和CMYK的互相转换组件 DevExpress girdControl如何双击进入编辑状态? 在C#中制作的安装程序只有310K,没有发现DLL,、.pdb文件是何文件? 请远程家教 c# 值类型如何转为引用类型? 散分+讨论 进来讨论下关于配置实现编程的思路
<div id=""FDate"" style=""display:none"">124566</div>";
string result = Regex.Replace(str, @"<div[^>]*?>.*</div>", "");
<td>8折/-</td>
<td class="FundNameLeft">
<div class="FD_FundOperationButton MarginLeft10"><a fundcode="000001" fundname="华夏成长" href="https://www.95599.cn/PersonalBank/startUpHtmlSessionAction.ebf?optype=2&amp;opcode=000001">申购</a></div>
<div class="FD_FundOperationButton"><a fundcode="000001" fundname="华夏成长" href="http://www.abchina.com/cn/EBanking/Ebanklogin/PCustomerLogin/default.htm">定投</a></div> <div class="FD_FundAddAttention"><a href="#" class="attentions">
关注
</a></div>
</td>像这样的
有嵌套的div能去掉吗?
<td>8折/-</td>
<td class=""FundNameLeft"">
<div class=""FD_FundOperationButton MarginLeft10""><a fundcode=""000001"" fundname=""华夏成长"" href=""https://www.95599.cn/PersonalBank/startUpHtmlSessionAction.ebf?optype=2&amp;opcode=000001"">申购</a></div>
<div class=""FD_FundOperationButton"">aa<div>bb</div><a fundcode=""000001"" fundname=""华夏成长"" href=""http://www.abchina.com/cn/EBanking/Ebanklogin/PCustomerLogin/default.htm"">定投</a></div> <div class=""FD_FundAddAttention""><a href=""#"" class=""attentions"">
关注
</a></div>
</td>";
string result = Regex.Replace(str, @"(?is)<div[^>]*?>.*</div>", "");
Console.WriteLine(result);
string pattern = @"(?is)<[^>]*?>";
string strResult = Regex.Replace(str, pattern, "");
Console.WriteLine(strResult);
Console.Read();