title: Regular expression replace html entity back to characters
body: <p>In PHP with MySQL, I need to convert specific html entities like &lt;p&gt; back to html for specific tags. The purpose is to allow users to render specific html tags like &lt;p&gt; and not &lt;script&gt;.</p>
  
  <p>I need the page to render this:
  <code>&lt;p&gt;paragraph&lt;/p&gt;break&amp;lt;script&amp;gt;alert(document.cookie);&amp;lt;/script&amp;gt;</code></p>
  
  <p>Given this string:
  <code>&amp;lt;p&amp;gt;paragraph&amp;lt;/p&amp;gt;break&amp;lt;script&amp;gt;alert document.cookie);&amp;lt;/script&amp;gt;</code></p>
  
  <p>I tried preg_replace.</p>
  
  <p>This is the regex I tried:
  <code>$bodyText = preg_replace('^&amp;lt;p&amp;gt;$', '&lt;p&gt;', $bodyText);</code></p>
  
  <p>I tried to convert &lt;p&gt; back to this:
  <code>&lt;p&gt;paragraph&lt;/p&gt;break&amp;lt;script&amp;gt;alert(document.cookie);&amp;lt;/script&amp;gt;</code></p>
  
  <p>But I get this error:
  <code>Warning: preg_replace(): No ending delimiter '^' found</code></p>
  
  <p>What is the best way to convert specific escaped tags back to html?</p>