note 85722 deleted from function.preg-replace by cmb
| From: | cmb@php.net | Date: | Sun, 22 Sep 2019 08:00:01 +0000 |
| Subject: | note 85722 deleted from function.preg-replace by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-212303@lists.php.net to get a copy of this message | ||
Note Submitter: tal at ashkenazi dot co dot il
----
after long time of tring get rid of \n\r and <BR> stuff i've came with this...
(i done some changes in clicklein() function...)
<?php
function clickable($url){
$url = str_replace("\\r","\r",$url);
$url = str_replace("\\n","\n<BR>",$url);
$url = str_replace("\\n\\r","\n\r",$url);
$in=array(
'
((?:https?|ftp)://\S+[[:alnum:]]/?)si',
'((?<!//)(www\.\S+[[:alnum:]]/?))si'
);
$out=array(
'<a href="$1" rel=nofollow>$1</a> ',
'<a href="http://$1"
rel=\'nofollow\'>$1</a>'
);
return preg_replace($in,$out,$url);
}
?>