in reply to Re: validating form input
in thread validating form input

I would like to delete everything but large and small case letters and numbers john larson

Replies are listed 'Best First'.
Re: Re: Re: validating form input
by leira (Monk) on Feb 25, 2004 at 22:10 UTC
    How about this?

    # replace non alphanumeric characters with '' $name =~ s/\W//g; # replace '_' with '' because \W doesn't catch those $name =~ s/_//g;

    Linda

Re: Re: Re: validating form input
by chanio (Priest) on Feb 25, 2004 at 20:07 UTC
    perl -e "my $t = \"ABC def 123*GHI;?. jk\"; $t =~ s/([^A-Z0-9 ])*//ig; + print $t;## don't accept any char. except... _______^"
    ...

    ABC def 123GHI jk

Re: Re: Re: validating form input
by TilRMan (Friar) on Feb 26, 2004 at 12:53 UTC

    You want the tr (transliteration) operator:

    $name =~ tr/A-Za-z0-9//cd;

     --
    LP^>