php preg_replace replacing hashtags
<p>I'm using this code to make hashtags:</p>

<pre><code>preg_replace(  '/\#([A-Za-z0-9]*)/is', ' &lt;a href="tag/$1"&gt; #$1&lt;/a&gt; ', $text);
</code></pre>

<p>It works, but when it comes across this: "it#039;s" (  "it's" ), it replaces it as well.
So I guess I want it to only replace hashtags if they have a white space before them, or are at the beginning of the line. Something like in this string below:</p>

<blockquote>
  <p>This is a #tag and this is
   #anotherTag but the word "it's" and "it#039;s" is not being replaced</p>
</blockquote>

<p>How do I change the preg to do this?
Thanks</p>