title: Warning: preg_replace() [function.preg-replace]: Compilation failed: nothing to repeat at offset 1
body: <p>Can someone help debug this error? </p>
  
  <blockquote>
    <p>Warning: preg_replace() [function.preg-replace]: Compilation failed:
    nothing to repeat at offset 1</p>
  </blockquote>
  
  <pre><code>//Generate uid
      function gen_uid($len=40) {
          $hex = md5("what" . uniqid("", true));
          $pack = pack('H*', $hex);
          $tmp =  base64_encode($pack);
          $uid = preg_replace("#(*UTF8)[^A-Za-z0-9]#", "", $tmp);
          $len = max(4, min(128, $len));
          while (strlen($uid) &lt; $len)
              $uid .= gen_uid(22);
          return substr($uid, 0, $len);
      }
  </code></pre>
  
  <p>What causes this? Is it a PHP issue or something else? The application works fine on my local machine but not on the server. </p>