title: How can I get a regular expression to match files ending in ".js" but not ".test.js"?
body: <p>I am using webpack which takes regular expressions to feed files into loaders. I want to exclude test files from build, and the test files end with <code>.test.js</code>. So, I am looking for a regular expression that would match <code>index.js</code> but not <code>index.test.js</code>.</p>
  
  <p>I tried to use a negative lookback assertion with</p>
  
  <pre><code>/(?&lt;!\.test)\.js$/
  </code></pre>
  
  <p>but it says that the expression is invalid.</p>
  
  <pre><code>SyntaxError: Invalid regular expression: /(?&lt;!\.test)\.js$/: Invalid group
  </code></pre>
  
  <p>example files names:</p>
  
  <pre><code>index.js          // &lt;-- should match
  index.test.js     // &lt;-- should not match
  component.js      // &lt;-- should match
  component.test.js // &lt;-- should not match
  </code></pre>