I tried the following code to test for bad characters but keep 
getting my error msg though the values passed do not contain chars 
that are not "A-Za-z0-9_@.-" (I also reread my last post and found 
that my English articulation was very poor, I'm grateful that anyone 
responded!).

#TEST FOR BAD CHARS
foreach my $i (keys %params)
{if ($params{$i}!=m/[^\w@.-]/g)
     {
      print $q->header( "text/html" );
      print <<"PrintTag";
     <html>
<head>
<STYLE type="text/css">
<!--
BODY {
background-color: #ffffcc;
font-size: 12pt;
color: #000066;
text-align: center
}
H1 {
font-size: 14pt
}
-->
</STYLE>
</head>
<body>
<center>
<h3>Alert!</h3>
<p align="center">I'm sorry but only letters, numbers, &#095;, 
&#064;, - and &#046; are allowed in your form fields.</p>
<p align="center">Please hit the back button of your browser and try again.</p>
</center>
</body>
</html>
PrintTag
exit(0);
}
}


>On Jul 23, Teresa Raymond said:
>
>>How would you correct this expression to accept only alpha/numeric
>>except the @ and . (period) symbols?  In other words, how would I add
>>multiple chars to exclude to the regex?
>
>Err, you mean "accept only alphanumerics AND @ and .".
>
>>if ($name=~/^W&&[^@]]+$/)
>>{     print "Only the @ and . characters are allowed";
>>}
>
>You're missing some characters in there...
>
>  if ($name =~ /[^\w@.]/) {
>    # character other than A-Z, a-z, 0-9, _, @, ., and local letters used
>  }
>
>--
>Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
>I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
>Are you a Monk?  http://www.perlmonks.com/     http://forums.perlguru.com/
>Perl Programmer at RiskMetrics Group, Inc.     http://www.riskmetrics.com/
>Acacia Fraternity, Rensselaer Chapter.         Brother #734
>**      Manning Publications, Co, is publishing my Perl Regex book      **
>
>
>
>--
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]

*** Teresa Raymond
*** http://www.mariposanet.com
*** [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to