title: get everything between <tag> and </tag> with php
body: <p>I'm trying to grab a string within a string using regex.</p>
  
  <p>I've looked and looked but I can't seem to get any of the examples I have to work.</p>
  
  <p>I need to grab the html tags &lt;code> and &lt;/code> and everything in between them.</p>
  
  <p>Then I need to pull the matched string from the parent string, do operations on both, </p>
  
  <p>then put the matched string back into the parent string.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>$content = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. &amp;lt;code&gt;Donec sed erat vel diam ultricies commodo. Nunc venenatis tellus eu quam suscipit quis fermentum dolor vehicula.&amp;lt;/code&gt;"
  $regex='';
  $code = preg_match($regex, $text, $matches);
  </code></pre>
  
  <p>I've already tried these without success:</p>
  
  <pre><code>$regex = "/&lt;code\s*(.*)\&gt;(.*)&lt;\/code&gt;/";
  $regex = "/&lt;code&gt;(.*)&lt;\/code&gt;/";
  </code></pre>