Hola, hace mucho tiempo tuve un problema similar y despues de mucho probar, me he quedado con esta funcion. Espero te sirva
Código PHP:
Ver originalfunction makeLinks($subject) {
$pattern = "/(?i)\b(((http|https|ftp):\/\/|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'\".,<>?«»“”‘’]))/";
$text = preg_replace($pattern, "<a href=\"http://$1\" target=\"_blank\">$1</a>", $subject); $text = str_replace("href=\"www.","href=\"http://www.",$text); $text = str_replace("href=\"http://http://","href=\"http://",$text); return $text;
}
Saludos