JavaScript - Find Hashtags in Text and Return With Link
<p>I'm trying to take my text and convert that hashtags to links and different colors than the normal text, but I have no idea how to go about it. I know it has something to do with regex, but I can't seem to get it down. Here's what I have so far, but it doesn't work at all:</p>

<pre><code>function hashtag(text) {
var repl = text.replace(/(^|\W)(#[a-z\d][\w-]*)/ig, '$1&lt;a style = "color: #35ab52"&gt;$2&lt;/a&gt;');
return(repl);
}
</code></pre>

<p>I'd appreciate any help, thanks!</p>