- preg_replace: documentation ( source)
<?php
function remTxt( $text )
{
//echo preg_replace("/[^0-9]/","",$text);
echo preg_replace("#(^|[\n ])(([\w]+?://[\w\#$%&~.\-;:=,?@\[\]+]*)(/[\w\#$%&~/.\-;:=,?@\[\]+]*)?)#is", "\\1<a href=\"\\2\" title=\"\\2\" rel=\"nofollow\">\\2</a>", $text);
}
remTxt("123wret456fgh678");
?>