title: RegEx not working in Javascript: SCRIPT5018: Unexpected quantifier
body: <p>I'm trying to make a RegEx that can single out words from a string but ignore them if they're inside a tag. For example: Even though the searchword is SPAN, do not replace a span tag.</p>
  
  <p>What I have so far is:</p>
  
  <pre><code>(?&lt;![&lt;\/])\bspan\b(?!&gt;)
  </code></pre>
  
  <p><a href="http://regex101.com/r/vS6yG6" rel="nofollow">http://regex101.com/r/vS6yG6</a></p>
  
  <p>Span obviously is a placeholder. In the script it is generated from a dictionary dynamically.</p>
  
  <p>This is what I'm trying to run: </p>
  
  <pre><code>var reg = new RegExp(the expression, 'gi');
  </code></pre>
  
  <p>I've escaped the /, so I'm not sure where the problem is.</p>
  
  <p>And this is what I get back: <code>SCRIPT5018: Unexpected quantifier</code></p>
  
  <p>Any help would be appreciated. I made the Regular Expression with the help of regex101.com.</p>