function html_url_to_link($string) {
$patterns = array();
$patterns[0] = '/user\/(.+)/';
$patterns[1] = '/http:\/\/(.+)/';
$replacements = array();
$replacements[0] = '<a href="/user/$1">user/$1</a>';
$replacements[1] = '<a href="$0">$0</a>';
return preg_replace($patterns, $replacements, $string);
}
If the text was http://website.com/user/account, the first array (0) would interfere with the second array (1).