in reply to Regex: Strip <script> tags?

skx has beter advice, but as for the question as you posed it:
s/<script[^>]*>.*?<\/script>//igs;
should work. It accepts any characters that are not ">", up to the ">" that terminates the tag. It may not be the best solution to this particular problem, but it's a very handy regex idiom to have ready access to.

Replies are listed 'Best First'.
Re^2: Regex: Strip <script> tags?
by ikegami (Patriarch) on Sep 02, 2007 at 20:01 UTC

    It lets the following through:

    <<script></script>script>...</script>

    It's also a poor regexp in a more general sense since it it doesn't check if the > actually closes the tag of it's inside the quotes of an attribute value.