Javascript regex for known script tag combinations
<p>Another regex question, yes, however the context for my implementation is within a Grunt process, with a known set of files to iterate and in those files are known combinations of script tags. There is zero chance of User interference, and the target files will not change over time.</p>

<p>Here are the combinations that I want to catch in a single regex:</p>

<pre><code>&lt;script&gt;*&lt;/script&gt;
&lt;script type="text/javascript"&gt;*&lt;/script&gt;
</code></pre>

<p>EDIT: The above combo should exclude:</p>

<pre><code>&lt;script src=""&gt;&lt;/script&gt;
&lt;script src="" type="text/javascript"&gt;&lt;/script&gt;
&lt;script SRC=""&gt;&lt;/script&gt;
&lt;script SRC="" TYPE="text/javascript"&gt;&lt;/script&gt;
</code></pre>

<p>And then I need a second regex to catch the following:</p>

<pre><code>&lt;!--[if lt IE 9]&gt;&lt;script&gt;*&lt;/script&gt;&lt;![endif]--&gt;
</code></pre>

<p>And finally a third regex to catch the following:</p>

<pre><code>&lt;!--[if lte IE 9]&gt;&lt;script&gt;*&lt;/script&gt;&lt;![endif]--&gt;
</code></pre>

<p>Please don't combine the regexes, as I need different outcomes for each.</p>

<p>For reference, I've worked my way through this SO answer q/a: <a href="https://stackoverflow.com/questions/6659351/removing-all-script-tags-from-html-with-js-regular-expression">Removing all script tags from html with JS Regular Expression</a></p>

<p>But they catch too much, and none of the suggestions there cater for a <em>separate</em> regex for the conditional IE comments that I need to treat separately.</p>

<p>Also, I have tried <code>grunt-dom-munger</code>, however there were too many undesirable outcomes, and so I am trying a simplified solution involving regex actions with separate outcomes, within <code>grunt-text-replace</code>.</p>

<p>Many thanks you clever, clever regex folk!</p>