title: How do I remove a node with Nokogiri?
body: <p>How can I remove <code>&lt;img&gt;</code> tags using Nokogiri?</p>
  
  <p>I have the following code but it wont work:</p>
  
  <pre><code># str = '&lt;img src="canadascapital.gc.ca/data/2/rec_imgs/5005_Pepsi_H1NB.gif"/…; testt&lt;a href="#"&gt;test&lt;/a&gt;tfbu' 
  
  f = Nokogiri::XML.fragment(str)
  f.search('//img').each do |node| 
    node.remove
  end
  puts f
  </code></pre>