title: Extracting specific text from HTML texts
body: <p>I am not so familiar with regex. I am trying to obtain the results described at the bottom. Here is what I have done so far (note that <code>$page</code> contains tabulators):</p>
  
  <pre><code>$page = "&lt;div class=\"title-container\"&gt;
                              &lt;h1&gt;Text here&lt;span&gt; /Sub-text/&lt;/span&gt; &lt;/h1&gt;
                                                       &lt;/div&gt;";
  // TITLE
  preg_match_all ('/&lt;h1&gt;(.*)&lt;\/h1&gt;/U', $page, $out);
  $hutitle = preg_replace("#&lt;span&gt;(.*)&lt;\/span&gt;\s#", "", $out[1][0]);
  
  $entitle = preg_replace("'(.*)&lt;span&gt; /'", "", $out[1][0]);
  </code></pre>
  
  <p>I would like to get this:</p>
  
  <pre><code>$hutitle = "Text here"; 
  $entitle = "Sub-text"; (Without html and "/")
  </code></pre>