in reply to Checking forms for JavaScript
$text =~ s/<SCRIPT[^>]> # the opening <SCRIPT...> tag .*? # as few chars as possible until... (?:</SCRIPT>|$) # closing script tag or the end of the tex +t ($) //xgis; # (x) comments (g)lobal, case (i)nsensitiv +e, # treat string as (s)ingle line # uncommented version $text =~ s/<SCRIPT[^>]>.*?(?:</SCRIPT>|$)//gis;
You need to check for strings that don't contain a closing tag, as this example below shows:
# imagine the following are two consecutive posts on a bulletin board $first_post = <<_END_; <SCRIPT LANGUAGE="Javascript"> document.location.href = "http://www.hamsterdance.com" /* _END_ $second_post = <<_END_; */ </SCRIPT> _END_
I actually used this once :)
HTH
cLive ;-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Checking forms for JavaScript
by shotgunefx (Parson) on Jul 24, 2001 at 03:26 UTC | |
by cLive ;-) (Prior) on Jul 24, 2001 at 04:03 UTC | |
by shotgunefx (Parson) on Jul 24, 2001 at 11:42 UTC |