免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1340 | 回复: 2
打印 上一主题 下一主题

[文本处理] [正则表达式] 删除更变态的格式... [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-08-17 10:47 |只看该作者 |倒序浏览
本帖最后由 peterdocter 于 2012-08-17 11:16 编辑

格式处理:
<h2>
<span>Rhymes with <em>BLAST</em>
</span>
</h2>

<a href="bast">bast</a>, <a href="cast">cast</a>, <a href="clast">clast</a>, <a href="fast">fast</a>, <a href="gast">gast</a>, <a href="ghast">ghast</a>, <a href="last">last</a>, <a href="mast">mast</a>, <a href="Nast">Nast</a>, <a href="past">past</a>, <a href="vast">vast</a>

<h2>
<span>Learn More About <em>BLAST</em>
</span>
</h2>


<a href="/thesaurus/blast" style="background: url(/images/lma_thes.jpg) no-repeat left 1px; padding-left: 20px; line-height: 16px; padding-bottom: 10px; text-decoration: none; color: black; font-weight: normal;">Thesaurus: </a>
<a href="/thesaurus/blast">All synonyms and antonyms for "blast"</a>

<a href="/spanish/blast" style="background: url(/images/lma_span.jpg) no-repeat left 1px; padding-left: 20px; line-height: 16px; padding-bottom: 10px; text-decoration: none; color: black; font-weight: normal;">Spanish-English Dictionary: </a>
<a href="/spanish/blast">Translation of "blast"</a>



<a href="/medical/blast" style="background: url(/images/lma_med.jpg) no-repeat left 1px; padding-left: 20px; line-height: 16px; padding-bottom: 10px; text-decoration: none; color: black; font-weight: normal;">Medical Dictionary: </a>
<a href="/medical/blast">Definition of "blast"</a>

<a href="http://www.britannica.com/EBchecked/topic/69016/blast" style="background: url(/images/lma_enc.jpg) no-repeat left 1px; padding-left: 20px; text-decoration: none; color: black; font-weight: normal;">Britannica.com: </a>


</>


<h2>
<span>Origin of <em>MANUBRIUM</em>
</span>
</h2>
New Latin, from Latin, handle, from <em xmlns:mwref="http://www.m-w.com/mwref">manus</em>
First Known Use: 1705



<h2>
<span>Learn More About <em>MANUBRIUM</em>
</span>
</h2>


<a href="/medical/manubrium" style="background: url(/images/lma_med.jpg) no-repeat left 1px; padding-left: 20px; line-height: 16px; padding-bottom: 10px; text-decoration: none; color: black; font-weight: normal;">Medical Dictionary: </a>
<a href="/medical/manubrium">Definition of "manubrium"</a>


<a href="http://www.britannica.com/EBchecked/topic/363096/manubrium" style="background: url(/images/lma_enc.jpg) no-repeat left 1px; padding-left: 20px; text-decoration: none; color: black; font-weight: normal;">Britannica.com: </a>
<a href="http://www.britannica.com/EBchecked/topic/363096/manubrium">Encyclopedia article about "manubrium"</a>



</>

<h2>
<span>Origin of <em>CARDIA</em>
</span>
</h2>
New Latin, from Greek <em xmlns:mwref="http://www.m-w.com/mwref">kardia</em> heart, upper orifice of the stomachFirst Known Use: 1782



<h2>
<span>Learn More About <em>CARDIA</em>
</span>
</h2>


<a href="/medical/cardia" style="background: url(/images/lma_med.jpg) no-repeat left 1px; padding-left: 20px; line-height: 16px; padding-bottom: 10px; text-decoration: none; color: black; font-weight: normal;">Medical Dictionary: </a>
<a href="/medical/cardia">Definition of "cardia"</a>



</>
-cardium


<h2>-cardium</h2> <span class="main-fl"> <em xmlns:mwref="http://www.m-w.com/mwref">noun combining form</em> </span>


<span xmlns:mwref="http://www.m-w.com/mwref" class="in"> <em>plural</em>  <strong>-cardia</strong>
</span>

注意:
开头是:
<h2>
<span>Learn More About <em>BLAST</em>
</span>
</h2>

结束是:
</>
但是要保留这个结束标签!

效果如下:
上面红色的就是要删除内容,注意是要删除不是提取...

<h2>
<span>Rhymes with <em>BLAST</em>
</span>
</h2>

<a href="bast">bast</a>, <a href="cast">cast</a>, <a href="clast">clast</a>, <a href="fast">fast</a>, <a href="gast">gast</a>, <a href="ghast">ghast</a>, <a href="last">last</a>, <a href="mast">mast</a>, <a href="Nast">Nast</a>, <a href="past">past</a>, <a href="vast">vast</a>

</>


<h2>
<span>Origin of <em>MANUBRIUM</em>
</span>
</h2>
New Latin, from Latin, handle, from <em xmlns:mwref="http://www.m-w.com/mwref">manus</em>
First Known Use: 1705

</>


<h2>
<span>Origin of <em>CARDIA</em>
</span>
</h2>
New Latin, from Greek <em xmlns:mwref="http://www.m-w.com/mwref">kardia</em> heart, upper orifice of the stomachFirst Known Use: 1782

</>
-cardium


<h2>-cardium</h2> <span class="main-fl"> <em xmlns:mwref="http://www.m-w.com/mwref">noun combining form</em> </span>


<span xmlns:mwref="http://www.m-w.com/mwref" class="in"> <em>plural</em>  <strong>-cardia</strong>
</span>

论坛徽章:
0
2 [报告]
发表于 2012-08-17 10:53 |只看该作者
太长了,不乐意看
如果删除的是大部分的内容,与其要删除,不如说要提取啥。。。
要删除的部分,用红色区别一下吧,上下对比,看起来累

论坛徽章:
0
3 [报告]
发表于 2012-08-17 11:14 |只看该作者
回复 2# personball
又修改一下,这样看不累了吧?

   
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP