Replace this, but not between these...
Posted: Wed May 03, 2006 10:23 am
Here is the code I have that turns URL's into hyperlinks:
The thing is, I don't want this to happen if the URL is inside tags, for obvious reasons.
Is this possible?
Code: Select all
$text = ereg_replace("[a-zA-Z]+://([.]?[a-zA-Z0-9_/?:+=&-])*", "<a href=\"\\0\">\\0</a>", $text);
$text = ereg_replace("(^| )(www([.]?[a-zA-Z0-9_/?:+=&-])*)", "\\1<a href=\"http://\\2\">\\2</a>", $text);Is this possible?