I don't understand the "\s*" at the start of the regex -- what's that doing there? Any amount of whitespace before the "script"? That would render the HTML invalid, surely?
I've never had any problems with
$html =~ s/<script[^>]*>.*?<\/script>//sgi
so maybe there's something strange in your content?
Randomly, what if there was some weird custom tag like <scriptblock> in there? You might need a \b after "script" in that case.
(Searching for weird possibilities) What if you had <script src="if-a->-b-script.js"> or something bizarre?
Show us a page on which it fails to perform correctly.
--
Every bit of code is either naturally related to the problem at hand, or else it's an accidental side effect of the fact that you happened to solve the problem using a digital computer.
M-J D
In reply to Re: Stripping the contents of Javascript tags
by Cody Pendant
in thread Stripping the contents of Javascript tags
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |