function makeClickableLinks($s) { return preg_replace('@(https?://([-\w\.]+[-\w])+(:\d+)?(/([\w/_\.#-]*(\?\S+)?[^\.\s])?)?)@', '<a href="$1" target="_blank">$1</a>', $s); }
wszystko ładnie pięknie, ale jak $s będzie typu:
http://test.pl/x-y-z-ó-ś
to już nie zadziała
