diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php
index cc5e76bdb5..7735d581a4 100644
--- a/wp-includes/formatting.php
+++ b/wp-includes/formatting.php
@@ -582,10 +582,11 @@ function antispambot($emailaddy, $mailto=0) {
}
function make_clickable($ret) {
- $ret = ' ' . $ret . ' ';
- $ret = preg_replace("#([\s>])(https?)://([^\s<>{}()]+[^\s.,<>{}()])#i", "$1$2://$3", $ret);
- $ret = preg_replace("#(\s)www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[^ <>{}()\n\r]*[^., <>{}()\n\r]?)?)#i", "$1www.$2.$3$4", $ret);
- $ret = preg_replace("#(\s)([a-z0-9\-_.]+)@([a-z0-9\-_.]+)\.([^,< \n\r]+)#i", "$1$2@$3.$4", $ret);
+ $ret = ' ' . $ret;
+ $ret = preg_replace("#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "$1$2", $ret);
+ $ret = preg_replace("#(^|[\n ])((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "$1$2", $ret);
+ $ret = preg_replace("#(\s)([a-z0-9\-_.]+)@([^,< \n\r]+)#i", "$1$2@$3", $ret);
+ $ret = substr($ret, 1);
$ret = trim($ret);
return $ret;
}