note 60501 deleted from function.strpos by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 16:36:49 +0000 |
| Subject: | note 60501 deleted from function.strpos by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-154865@lists.php.net to get a copy of this message | ||
Note Submitter: msandersen at t tpg dot com dot au
----
<?PHP
$txt = preg_replace("|(<script.+</script>)|Usi", "", $txt);
?>
No point in keeping empty script tags. Ungreedy will prevent overzealous content removal where there
are more than one set of script tags on the page. Multiline has no use here.
Otherwise, if you absolutely must have the empty tags:
<?PHP
$txt = preg_replace("|<script[^>]*>(.+)</script>|Usi", "", $txt);
?>
Martin