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.
Here are the combinations that I want to catch in a single regex:
<script>*</script>
<script type="text/javascript">*</script>
EDIT: The above combo should exclude:
<script src=""></script>
<script src="" type="text/javascript"></script>
<script SRC=""></script>
<script SRC="" TYPE="text/javascript"></script>
And then I need a second regex to catch the following:
<!--[if lt IE 9]><script>*</script><![endif]-->
And finally a third regex to catch the following:
<!--[if lte IE 9]><script>*</script><![endif]-->
Please don't combine the regexes, as I need different outcomes for each.
For reference, I've worked my way through this SO answer q/a: Removing all script tags from html with JS Regular Expression
But they catch too much, and none of the suggestions there cater for a separate regex for the conditional IE comments that I need to treat separately.
Also, I have tried grunt-dom-munger, however there were too many undesirable outcomes, and so I am trying a simplified solution involving regex actions with separate outcomes, within grunt-text-replace.
Many thanks you clever, clever regex folk!
.*?at each*, and some escape slashes for escaping brackets and forward slashes.