RegEx to get attributes and body of script tags
html, regex
Solution
change your first * to *?
This is the non-greedy 'match all', so it will match the smallest set of characters before the next '>'.
Problem
I'm using this regex to find <script> tags: ``` <script (.|\n)*>(.|\n)*?</script> ``` The problem is, it matches the ENTIRE string below, not just each tag separately: ``` <script src="crap2.js"></script><script src="crap2.js"></script> ```