I've the following script which hyperlinks any links posted on my site:
$text = trim($text);
while ($text != stripslashes($text)) { $text = stripslashes($text); }
$text = strip_tags($text,"<b><i><u>");
$text = preg_replace("/(?<!http:\/\/)www\./","http://www.",$text);
$text = preg_replace( "/((http|ftp)+(s)?:\/\/[^<>\s]+)/i", "<a href=\"\\0\" target=\"_new\">\\0</a>",$text);
However, for some reason if I add a https://www.test.com
link it ends up displaying like this - https://http://www.test.com
- what am I doing wrong? How can I make it work with https links as well? It works fine with http links. Thank you! :-)