Regex ? does not work
<pre><code>var contents = [];
contents.push('\r\n"use strict";');
contents.push('\n"use strict";');

var useStrictRegExp = /([^{]\r?\n)['"]use strict['"];/g;

for (var i = 0; i &lt; contents.length; ++i) {
  var content = contents[i];
  console.log('before', content);
  var replaced = content.replace(useStrictRegExp, '$1');
  console.log('after', replaced);
}
</code></pre>

<p>This is meant to match <code>"use strict";</code> not inside a bracket.</p>

<p>But it seems to fail when not using Windows line endings. The output is:</p>

<pre><code>before 
"use strict";
after 

before 
"use strict";
after 
"use strict";
</code></pre>

<p>I have no idea why.</p>