title: Why doesn't Regexp match?
body: <p>Can anybody please tell me why doesn't this Regexp match?</p>
  
  <pre><code>var matches = ' @test'.match(new RegExp('(\s+|^)(@|!)(.*?)(\s+|$)', 'g'));
  </code></pre>
  
  <p>whereas this one matches:</p>
  
  <pre><code>var matches = '@test'.match(new RegExp('(\s+|^)(@|!)(.*?)(\s+|$)', 'g'));
  </code></pre>
  
  <p>I have already specified <code>\s+</code>. Why wouldn't it match it then?</p>