Using PHP I need I will have an array of tag name => tag URL
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 <h1>
, <h2>
, or <code> and <pre>
tags it will not do it. Possibly to simplify, I could say it has to be inside a <p>
tag for the switch to take place.
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
so a PHP
tag would be turned into <a href="link here">PHP</a>