Or a really one:
if ($x =~ /\D/) {
print "found non digit, do not pass go, no 20 grands for you";
} else {
print "good boy";
}
where \D stands for NON digits
regards,
Jos Boumans
"Brett W. McCoy" wrote:
> On Wed, 23 May 2001, Kyrytow, Stefan wrote:
>
> > As you can see the last two inputs should not be accepted. I am using $x =~
> > /[0-9]/ as my filter. I understand why the values are being accepted, I am
> > searching for a number and 12bob & bob12 each contain a number.
> >
> > What I do not understand is how to search for just a number.
>
> The problem is that your regexp is matching *any* string that contains the
> pattern. You want to narrow your expression down a bit.
>
> Try:
>
> $x =~ /^\d+$/.
>
> -- Brett