Codice PHP:
// The Regular Expression filter
function creaUrl($text){
$reg_exUrl = "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/";
// Check if there is a url in the text
if(preg_match($reg_exUrl, $text, $url)) {
// make the urls hyper links
return preg_replace($reg_exUrl, '[url="'.$url[0].'"]'.$url[0].'[/url]', $text);
} else {
// if no urls in the text just return the text
return $text;
}
}
$str= file_get_contents("Text.txt");
$str = creaUrl(nl2br($str)); // il secondo parametro di nl2br puoi ometterlo tanto è comunque true di default
echo $str;
così dovrebbe andare .... certo che per iniziare a capire il php sei partita dalla cosa più complicata (le espressioni regolari) ..... però se non ti arrendi iniziare dalle cose più difficili a volte è la strada migliore
buon lavoro