fix linkify to work with with ip addresses (#8226)

* fix linkify to work with with ip addresses

* update tests
This commit is contained in:
Tony Murray
2018-02-07 20:48:18 -06:00
committed by GitHub
parent 8abe508cfd
commit 6bbe5038e8
2 changed files with 3 additions and 3 deletions

View File

@ -185,7 +185,7 @@ function toner2colour($descr, $percent)
*/
function linkify($text)
{
$regex = "/(http|https|ftp|ftps):\/\/[a-z0-9\-.]+\.[a-z]{2,5}(\/\S*)?/i";
$regex = "#(http|https|ftp|ftps)://[a-z0-9\-.]*[a-z0-9\-]+(/\S*)?#i";
return preg_replace($regex, '<a href="$0">$0</a>', $text);
}