title: Find and replace HTML tags
body: <p>I have the following HTML:</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  &lt;h1&gt;Foo&lt;/h1&gt;
  &lt;p&gt;The quick brown fox.&lt;/p&gt;
  &lt;h1&gt;Bar&lt;/h1&gt;
  &lt;p&gt;Jumps over the lazy dog.&lt;/p&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I'd like to change it into the following HTML:</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  &lt;p class="title"&gt;Foo&lt;/p&gt;
  &lt;p&gt;The quick brown fox.&lt;/p&gt;
  &lt;p class="title"&gt;Bar&lt;/p&gt;
  &lt;p&gt;Jumps over the lazy dog.&lt;/p&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>How can I find and replace certain HTML tags? I can use the <a href="http://nokogiri.rubyforge.org/nokogiri/" rel="nofollow noreferrer">Nokogiri</a> gem.</p>