比如有一段html
Code
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->somedo<divclass="postTitle"><aid="homepage1_HomePageDays_DaysList_ctl01_DayItem_DayList_ctl02_TitleUrl"="postTitle2"href="http://www.cnblogs.com/netfuns/archive/2009/09/28/1575829.html">把一个sqlwhere表达式转化为一个二叉树</addddiv12></br/>如题。比如我们有一个sqlselecta.idfromb,cwhere/> (b.id=c.id)and((b.code='a'andc.code='d')orb.name='c')/><将where后面的表达式转化为二叉树.:(俺也不会有空研究研究div="postDesc"posted@="http://www.cnblogs.com/netfuns/archive/2009/09/28/1575829.html"Title="permalink"2009-09-2817:02netfuns阅读(45)|="http://www.cnblogs.com/netfuns/archive/2009/09/28/1575829.html#FeedBack"="comments,pingbacks,trackbacks"评论(0)|="http://www.cnblogs.com/netfuns/admin/EditPosts.aspx?postid=1575829"编辑
=level1level1
=level2level2
level3someend
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->somedo<divclass="postTitle"><aid="homepage1_HomePageDays_DaysList_ctl01_DayItem_DayList_ctl02_TitleUrl"="postTitle2"href="http://www.cnblogs.com/netfuns/archive/2009/09/28/1575829.html">把一个sqlwhere表达式转化为一个二叉树</addddiv12></br/>如题。比如我们有一个sqlselecta.idfromb,cwhere/> (b.id=c.id)and((b.code='a'andc.code='d')orb.name='c')/><将where后面的表达式转化为二叉树.:(俺也不会有空研究研究div="postDesc"posted@="http://www.cnblogs.com/netfuns/archive/2009/09/28/1575829.html"Title="permalink"2009-09-2817:02netfuns阅读(45)|="http://www.cnblogs.com/netfuns/archive/2009/09/28/1575829.html#FeedBack"="comments,pingbacks,trackbacks"评论(0)|="http://www.cnblogs.com/netfuns/admin/EditPosts.aspx?postid=1575829"编辑
=level1level1
=level2level2
level3someend
正则1:<div class ="postTitle">(?<name>[\s\S]+?)</div>
结果为
<div class ="postTitle">dddd<a id="homepage1_HomePageDays_DaysList_ctl01_DayItem_DayList_ctl02_TitleUrl" class="postTitle2" href="<A" target="_blank" rel="nofollow">http://www.cnblogs.com/netfuns/archive/2009/09/28/1575829.html">把一个sql where表达式转化为一个二叉树</a>ddd<div>1 <div >2</div>
说明不能嵌套。但对于简单的标记是 可以 了。
正则2 :
<div class ="postTitle">(?<mycontent>[\s\S]+)</div>
结果:
得到整个div,包括嵌套的 内容 .
说明对于嵌套的html标记内容提取是可以的