-
SitePoint Enthusiast
I'm not very good at these expressions.
with the following code
my $BlockTag;
$HTML_Text =qq~all
about
<SCRIPT what>
the script
</SCRIPT>
html
~;
my $BlockTag;
foreach $BlockTag ('SCRIPT', 'STYLE') {
my $NewText = '';
foreach (split(m!</$BlockTag>!i, $HTML_Text)) {
if (m!^(.*?)<$BlockTag!i) {
$NewText .= $1;
}
else {
$NewText .= $_;
}
}
$HTML_Text = $NewText;
}
print $HTML_Text
i wish to remove the lines between the <SCRIP.. till </SCRIPT> and be left with
all
about
html
but the code only works if the first word is <SCRIPT, if not it just put out silly stuff.
any ideas?
thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks