I want to convert links such as http://google.com/ to HTML, however if they're already in an HTML link, either in the href="" or in the text for the link, I don't want to convert them.
I found this in another question:
preg_replace('@(https?:\/\/([-\w\.]+[-\w])+(:\d+)?(/([\w/_\.#-]*(\?\S+)?[^\.\s])?)?)@', '<a href="$1" target="_blank">$1</a>', $text);
However if I have something such as:
<a href="http://google.com/">http://google.com/</a>
already in the target text in question, it will create two links within that HTML. I can't seem to figure out the pattern for knowing if it's before /a or inside " ".