Re: reg expression for stripping Java scrips off HTML?
| From: | Ignatius Reilly | Date: | Wed, 16 Oct 2002 10:54:36 +0000 |
| Subject: | Re: reg expression for stripping Java scrips off HTML? | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-16397@lists.php.net to get a copy of this message | ||
Try:
preg_replace( "/<script.*>((.|[[:space:]])*)<\/script>/", "\\1",
$myHTMLstring )
seems to work here - applies to both cases
HTH
Ignatius
____________________________________________
----- Original Message -----
From: <yy_73@ukr.net>
To: <php-windows@lists.php.net>
Sent: Wednesday, October 16, 2002 11:44 AM
Subject: [PHP-WIN] reg expression for stripping Java scrips off HTML?
> Can anyone please provide me with the regular expression (Perl compatible
> or posix extended, whatever), that i can use to strip off the Java script
> tags and code of the HTML page. i have it 2 types:
>
> 1) <script language="javascript" src="***.js"> </script>
> and
> 2) <script>
> ----------code-------- \r\n
> ----------code-------- \r\n
> </script>
>
> i am using preg_replace("/(?s)<script[^>]{0,}script[*\s]{0,}>/iU",
> "--stripped--", $myHTMLstring) but this doesnt work properly.
>
> respects,
> YY.
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>