Invalid regular expression: Invalid group <p>I'm trying to write a regex with a negative lookahead that detects files which end with <code>.apk</code> but not with <code>-unaligned.apk</code>. Here it is.</p> <pre><code>/(?s)^((?!\-unaligned).)*\.apk$/ </code></pre> <p>However, when I use it in Node (or in the Chrome developer tools, too), it throws:</p> <pre><code>SyntaxError: Invalid regular expression: /(?s)^((?!\-unaligned).)*\.apk$/: Invalid group </code></pre> <p>I've tested it in <a href="http://regex101.com" rel="nofollow">Regex101</a> with a test list of files, and it works perfectly, but after moving to "production" code, it throws an error like that.</p>