Hello,
I have the following code which I am using for text->link conversions:
function hyperlink($text)
{
$text = preg_replace("#([\n ])([a-z]+?)://([^, \n\r]+)#i", "\\1<a href=\"\\2://\\3\" target=\"_blank\">\\2://\\3</a>", $text); // Link with http
$text = preg_replace("#([\n ])www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[^, \n\r]*)?)#i", "\\1<a href=\"http://www.\\2.\\3\\4\" target=\"_blank\">www.\\2.\\3\\4</a>", $text); // Link without http
$text = preg_replace("#([\n ])([a-z0-9\-_.]+?)@([^, \n\r]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $text); // E-mail
return $text;
}
This works fine except for links with GET variables.
For example:
http://www.google.com [Works fine]
http://www.google.com?p=index [Only counts the link up to the ?]
What would be needed to remedy this to accept all links?
Thanks,
J.