$re = '/(?:[a-z]{3,9}:\/\/?[\-;:&=\+\$,\w]+?[a-z0-9\.\-]+|[\/a-z0-9]+\.|[\-;:&=\+\$,\w]+@)[a-z0-9\.\-]+(?:(?:\/[\+~%\/\.\w\-_]*)?\??[\-\+=&;%@\.\w_]*#?[\.\!\/\\\\\w]*)?/i';
$str = '[PT]Consultório de dentista equipado e pronto //sssss.ssss.sss a funcionar.<br />Com la/boratório, sala de espera, escritório e wc.<br />Alarme instalado. Sistema de som interligado para todas as divisões.<br />Prédio com porteiro.<br />2 minutos (a pé) da estação de metro da Trindade.<br /><br />Fotos 360º:<br /><br />Consultório + Laboratório<br />https://photosynth.net/view.aspx?cid=f0e5b9db-fdec-4e50-9a83-69d7c2bc44e7<br /><br />Escritório<br />https://photosynth.net/view.aspx?cid=da4c64fe-c4cf-45f5-8bf9-ff62d369e98a<br /><br />Sala de espera<br />https://photosynth.net/view.aspx?cid=b631fd55-f7e7-41b3-a9a2-2f687dffeec8[/PT][EN]Consultório + Laboratório<br />http://photosynth.net/view.aspx?cid=f0e5b9db-fdec-4e50-9a83-69d7c2bc44e7[/EN][FR]Consultório + Laboratório<br />www.photosynth.net/view.aspx?cid=f0e5b9db-fdec-4e50-9a83-69d7c2bc44e7[/FR]';
$subst = "(url)$U";
$result = preg_replace($re, $subst, $str);
echo "The result of the substitution is ".$result;
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php