I use this preg_replace to change text urls to clickable in my script: Replacing Text link as link with preg_replace
yesterday I tested my script and these preg_replace doesn't work fine.
Here is example:
(...) stronie http://tpn.pl/nowosci/uwaga-skiturowcy-1).
And these preg_replace finally create this:
stronie <a href="http://tpn.pl/nowosci/uwaga-skiturowcy-1)." target="_blank">tpn.pl</a>
Why this preg_replace added ")." at the end of an URL? How to accept only "A-Z, a-z, 0-9, /" at the end of an URL string (I think I wrote everything accept ends of url ?)?
Thanks.
EDIT:
Here is my code:
$sub_message = preg_replace('|([\w\d]*)\s?(https?://([\d\w\.-]+\.[\w\.]{2,6})[^\s\]\[\<\>]*/?)|i', '$1 <a target="_blank" href="$2">$3</a>', $value['description']);
$sub_message = trim(str_replace("\n", "<br />", $sub_message));