使用正则表达式删除Notepad ++中的XML元素

时间:2014-09-21 22:53:47

标签: regex notepad++

我有一些像这样的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 ++中元素内的所有内容。我怎么能做到这一点?

1 个答案:

答案 0 :(得分:0)

正则表达式不是最好的工具,但如果能够工作,你可以试试这个:

(?<=<div class='post-outer'>)[\s\S]*?(?=<!-- Latest Responsive Under Post Add -->)

将其替换为空字符串''