<div class="a"> 里面有标签可能也有div </div>有没有什么办法 不管理面有什么标签 或者DIV 什么的。 我都只取从第一个div到对应的</div>结束里面的东西
解决方案 »
- 网站创建win2003系统用户和IIS应用程序池问题
- 有个客户要让我做.net的日语网站,操作系统是2003中文版的。请问下,开发过程中应该注意哪些问题呢
- css不能生效的问题求助
- oracle 表中有一date字段,要把系统当前时间插入表中,sql怎么写呢?
- 如何通过程序来修改asp:ButtonColumn 中的text属性
- 如何访问GridView的PagerTemplate中的TextBox的属性
- 如何出现提示框?
- 各位大侠!怎么把dropdownlist里接收得到的值传到下一页?
- 如何将string数据封装成 xml ???
- lodop打印控件问题,急急急!
- asp.net
- dropdownlist数据绑定后取值的问题
xmlDoc.LoadXml(s);
取xmlDoc.DocumentElement.InnerXml就是了。最好用HtmlAgilityPack中的HtmlDocument而不是XmlDocument。
//根据class=a来匹配
Regex reg = new Regex(@"(?isx)<div[^>]*class=(['""]?)a\1[^>]*?>(?><div[^>]*> (?<Open>)|</div> (?<-Open>)|(?:(?!</?div\b).)*)*(?(Open)(?!))</div>");
string match_str = reg.Match(test).Value;
/*
<div id=""1"" class=""a""> 1 <div id=""2""> 2 </div> </div>
*/
using System.Text.RegularExpressions; //需要引用
public string HtmlFilter(string strHtml) //从字符串里删除HTML
{
Regex regex = new Regex("<[^>]*>", RegexOptions.IgnoreCase);
string strOutput = regex.Replace(strHtml, "");
return strOutput;
}