title: how to get details in html tags using preg_match_all
body: <p>I'm using <code>preg_match_all</code> function to grab details on a web page. But problem is it returns exact matches to the given structure.</p>
  
  <p>Example:</p>
  
  <pre><code>&lt;span class="st"&gt;Details I want to get&lt;/span&gt;
  </code></pre>
  
  <p>But actually it looks like:</p>
  
  <pre><code>&lt;span class="st"&gt;&lt;em&gt;Details &lt;/em&gt;I want to &lt;b&gt;get&lt;b&gt;&lt;/span&gt;
  </code></pre>
  
  <p>So it returns just a few results that exactly match the above given first code!</p>
  
  <p>I found an article about grabbing &amp; there was a code and is it possible to do this using a code like this because I found this working with above structure?</p>
  
  <pre><code>$nodes = $xPath-&gt;query('//span[@class="st"]');
  foreach($nodes as $node) {
      echo $node-&gt;nodeValue, PHP_EOL;
  }
  </code></pre>