title: regex match question
body: <p>I want to match any of these cases with a regex. I have the header text, but I need to match it with the (possible) corresponding HTML:</p>
  
  <pre><code>&lt;h1&gt;header title&lt;/h1&gt;
  &lt;h2&gt;site | header title&lt;/h2&gt;
  &lt;h3 class="header"&gt;header title&lt;/h3&gt;
  &lt;h2&gt;header title 23 jan 2009&lt;/h2&gt;
  &lt;h1&gt;header title&lt;/h1&gt;
  </code></pre>
  
  <p>I have this:</p>
  
  <pre><code>/(&lt;(h1|h2|h3))(.+?)".$title."(.+?)(&lt;\/\\2&gt;)/i
  </code></pre>
  
  <p>But it seems to not always work, and don't see why.</p>
  
  <p>Thanks</p>