Well only you can be the judge if you are doing it right. But what that
expression tells me is:
$string matches, starting with either ( a word, a dot, a hyphen, a at sign,
a colon, a plus sign, a question mark, a bang) one or more times, and
ending in one of the afore mentioned.
So if that is what you want to check for then my guess is that you are
correct, however I would also check for ';' and '&&' and '&' but then you
have all you're control characters to look out for, and you also have to
watch out for the back tick.
My suggestion would be to use #!/usr/bin/perl -w -T
Then scan to see if it contains the characters you do want, not the ones
you don't. I would guess that the characters you will allow is much
simplier than the ones you won't.
my( $string ) =~ $q->param( "string" ) =~ /^([\w.])$/;
unless ($string) {
print "<B>ERROR, invalid characters used.! Character =
$string</B><BR>";
exit;
}
Just my two cents.
Jeff
On 2001.08.23 00:48 Sergio Gonzalez wrote:
> Can anyone tell me if i'm doing this right?
> #check for dangerous characters
>
> unless ($string =~ /^[\w .-\@:+?!]+$/) {
> print "<B>ERROR, invalid characters used.! Character =
> $string</B><BR>";
> exit;
> }
>
> thank you,
>
> Sergio Gonzalez
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]