
japhy
Enthusiast
Feb 17, 2000, 4:07 AM
Post #4 of 4
(2024 views)
|
If there is a set of characters you WON'T allow, there is also a set you WILL. Test based on whichever is smaller: <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> # don't allow , . / < > or ? if ($string =~ /[,./<>?]/) { bad data } # don't allow non-alphanumberscores # that's anything that's not a-zA-Z0-9_ if ($string =~ /\W/) { \W is opposite of \w } </pre><HR></BLOCKQUOTE>
|