Forum Moderators: coopster
http://foo.com part of the text, trying to avoid messing with the <a> tags if they ALREADY exist somewhere. this is a http://foo.com text <a href="http://bar.com">bar avoid it</a> this is a <a href="http://foo.com">http://foo.com</a> text <a href="http://bar.com">bar avoid it</a> $item_link = preg_replace("/(?!(?:[^<]+>|[^>]+<\/a>))\b(http)\b/is", "<a href=\"\\1\">\\1</a>",$item_link);