There is a function that highlights the links in the text. Links like: http://google.com and www.google.ru stand out successfully, but google.ru is not highlighted. That is, you need a third regular expression for replacing links like google.ru
function link_it($text) { // преобразование текста в ссылку $text = preg_replace('/(http:\/\/([\w\d\.\?\&\#\;\:\+\-\=\%\/]+))/i', '<a href="$1">$1</a>', $text); $text = preg_replace('/(www.([a-zA-Z_0-9\.\?\&\#\;\:\+\-\=\%\/]*))/i', '<a href="http://$1">$1</a>', $text); return($text); }