我有一些像这样的XML:
<div class='post-outer'>
<article class='post hentry' id='311698957029370981' itemscope='' itemtype='http://schema.org/BlogPosting'>
<h1 class='post-title entry-title' itemprop='name headline'>
Tawakkal Fabrics Midsummer Signature Series Collection 2014-2015
</h1>
<div class='post-body entry-content' id='post-body-311698957029370981' itemprop='description articleBody'>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Latest Responsive Under Post Add -->
我想将其更改为:
<div class='post-outer'><!-- Latest Responsive Under Post Add -->
使用正则表达式删除Notepad ++中元素内的所有内容。我怎么能做到这一点?
答案 0 :(得分:0)
正则表达式不是最好的工具,但如果能够工作,你可以试试这个:
(?<=<div class='post-outer'>)[\s\S]*?(?=<!-- Latest Responsive Under Post Add -->)
将其替换为空字符串''