If Cubes is right on what you're doing, I suggest you strip out all <script...> tags - whatever the scripting language. Here's a regex for this:
$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 ;-)


In reply to Re: Checking forms for JavaScript by cLive ;-)
in thread Checking forms for JavaScript by Sullust

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.