title: Javascript Regex to replace not working as expected
body: <p>Test string is:</p>
  
  <pre><code>hello hello hello
  
  &lt;span class="self-reference"&gt;Tom&lt;/span&gt; I don't know &lt;span class="self-reference"&gt;Tom&lt;/span&gt; I don't think.
  </code></pre>
  
  <p>I wish to to come out as:</p>
  
  <pre><code>hello hello hello
  
  @Tom I don't know @Tom I don't think.
  </code></pre>
  
  <p>I use this regex:</p>
  
  <pre><code>comment = comment.replace(/\&lt;span class="self-reference"\&gt;(.*)\&lt;\/span\&gt;/gi,"@$1");
  </code></pre>
  
  <p>But it outputs:</p>
  
  <pre><code>hello hello hello
  
  @Tom&lt;/span&gt; I don't know &lt;span class="self-reference"&gt;Tom I don't think.
  </code></pre>
  
  <p>Can anyone tell me how to modify this so it works as expected?</p>