title: Recognising Hashtags in Javascript
body: <p>I need to recognise hashtags (#example) in a string using javascript and change them to </p>
  
  <pre><code>&lt;a href='#/tags/example'&gt;example&lt;/a&gt;
  </code></pre>
  
  <p>at the moment I am using this code:</p>
  
  <pre><code>var string = '#hello This is an #example of some text';
  
  string.replace(/(^|\s)(#[a-z\d-]+)/ig, "$1&lt;a href='#/tags/$2'&gt;$2&lt;/a&gt;");
  </code></pre>
  
  <p>however the value of $2 still includes the # character and I need to omit this for the url</p>