Page 1 of 1

Replace this, but not between these...

Posted: Wed May 03, 2006 10:23 am
by Grim...
Here is the code I have that turns URL's into hyperlinks:

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);
The thing is, I don't want this to happen if the URL is inside tags, for obvious reasons.

Is this possible?

Posted: Wed May 03, 2006 10:27 am
by feyd
have you looked through phpbb's bbcode.php file?

Posted: Wed May 03, 2006 10:49 am
by Grim...
No, but I will.

I suspect, however, that my reaction will be something like 8O

Posted: Wed May 03, 2006 10:54 am
by Grim...
8O

Posted: Thu May 04, 2006 2:02 am
by CallumD
:D