Javascript Regular Expression failing in IE, but working in Chrome & Edge
<p>Im trying to replace illegal characters from a filename using a regular expression in javascript but it keeps falling over in IE 11 with 'Syntax error in regular expression'.  The same code works fine in Chrome and Edge.</p>

<pre><code>String.prototype.replaceAll = function (search, replacement) {
     var target = this;
     return target.replace(search, replacement);
};

var filename = 'test+&amp;+this+again.2016.txt';

filename = filename.replaceAll(new RegExp(/[^a-zA-Z0-9_\-&amp;.]+/, 'g'), '_');
</code></pre>

<p>Desired output is </p>

<pre><code>filename = 'test_&amp;_this_again.2016.txt';
</code></pre>

<p>Any help would be greatly appreciated.</p>

<p>Thanks</p>