[code] <?php
function url($text)
{
$text = preg_replace("~(^|\s|-|:| |\()(http(s?)://|(www\.))((\S{25})(\S{5,})(\S{15})([^\<\s.,>
\];'\"!?]))~i", "\\1<a href=\"http\\3://\\4\\5\">\\4\\6...\\8\\9</a>", $text);
$text = preg_replace("~(^|\s|-|:|\(| |\xAB)(http(s?)://|(www\.))((\S+)([^\<\s.,>
\];'\"!?]))~i", "\\1<a href=\"http\\3://\\4\\5\">\\4\\5</a>", $text);
return $text;
}
echo url('текст
http://profiwm.com/forum/thema77925 текст');
?>
[/code]
Добавлено 11.12.15 в 11:25:22:
http://dumpz.org/1813843/