title: Needle in haystack with array in PHP
body: <p>Using PHP I need I will have an array of <code>tag name =&gt; tag URL</code> I need to somehow scan a text input (will be somewhat large, a blog post) and find all tag names in the text and replace them with the URL link.  To complicate it though, if the tag name is inside <code>&lt;h1&gt;</code>, <code>&lt;h2&gt;</code>, or <code>&lt;code&gt; and &lt;pre&gt;</code> tags it will not do it.  Possibly to simplify, I could say it has to be inside a <code>&lt;p&gt;</code> tag for the switch to take place.</p>
  
  <p>I am not sure how to accomplish this, I know I will need regex but I am a bit lost at the moment, if anyone could help me some I would greatly appreciate it</p>
  
  <p>so a <code>PHP</code> tag would be turned into <code>&lt;a href="link here"&gt;PHP&lt;/a&gt;</code></p>