How would a regex look that makes text that starts with either http or www clickable?
My current bbcode:
function bbcode($text) {
$text = htmlspecialchars($text);
$text = nl2br($text);
$find = array(
"'\[b\](.*?)\[/b\]'is",
"'\[i\](.*?)\[/i\]'i",
"'\[url\](.*?)\[/url\]'i"
);
$replace = array(
"\\1",
"\\1",
"\\1"
);
$text = preg_replace($find, $replace, $text);
return $text;
}
As you can see I use [url]link[/url] for links ATM.
Thanks in advance.
P.S. the html in replace array wont show...