如何阻止一个preg替换阵列干扰另一个?

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).

I was able to make it functional by flipping the patterns around and adjusting them a bit:

$patterns = array();
$patterns[] = '/http:\/\/([^\/]+)\//';
$patterns[] = '/user\/(.+)/';

$replacements = array();
$replacements[] = '<a href="$0">$0</a>';
$replacements[] = '<a href="/user/$1">user/$1</a>';

$string = 'http://website.com/user/account';

echo preg_replace($patterns, $replacements, $string);

Resulting in...

<a href="http://website.com/">http://website.com/</a><a href="/user/account">user/account</a>