title: How can I remove HTML span tags with a Perl one liner?
body: <p>I want to perform the following vim substitution as a one-liner in the terminal with Perl. I would prefer to allow for any occurences of whitespace or newlines, rather than explicitly catering for them as I am below.    </p>
  
  <pre><code>%s/blockDontForget"&gt;\n*\s*&lt;p&gt;&lt;span&gt;&lt;a\(.*\)&lt;\/span&gt;/blockDontForget"&gt;&lt;p&gt;&lt;a\1/g 
  </code></pre>
  
  <p>I've tried this:</p>
  
  <pre><code>perl -pi -e 's/blockDontForget"&gt;&lt;p&gt;&lt;span&gt;&lt;a(.*)&lt;\/span&gt;/blockDontForget"&gt;&lt;p&gt;&lt;a$1/msg'
  </code></pre>
  
  <p>I presume I am misinterpreting the flags. Where am I going wrong? Thanks.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>The above example is to strip the spans out of the following html:</p>
  
  <pre><code>&lt;div class="block blockDontForget"&gt;
      &lt;p&gt;&lt;span&gt;&lt;a href="../../../foo/bar/x/x.html"&gt;Lorem Ipsum&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;      
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p>It's just the <code>&lt;span&gt;</code>'s and <code>&lt;/span&gt;</code>'s that are inbetween <code>&lt;p&gt;</code> and <code>&lt;a&gt;</code> from the "blockDontForget" class<br>
      <code>&lt;/div&gt;</code> that I want to remove (there are lots or these <code>blockDontForget</code> divs with spans inside anchors that I want to keep).</p>