I am trying to return the contents of any tags in the text. I am currently using the following expression, but it only captures the contents of the first tag and then ignores the others.
Here's a sample html:
<script type="text/javascript">
alert('1');
</script>
<div>Test</div>
<script type="text/javascript">
alert('2');
</script>
My regex looks like this:
re = /<script\b[^>]*>([\s\S]*?)<\/script>/gm;
var scripts = re.exec(scripttext);
When I run this in IE6, it returns 2 matches. The first contains the full tag, the second contains the warning ('1').
When I run it at http://www.pagecolumn.com/tool/regtest.htm , it gives me 2 results, each of which contains only script tags.
Geuis source
share