in reply to Re: •Re: Validating User Input
in thread Validating User Input

Speed. And yours is incorrect, as it will pass fred\n. It's very easy to get a regular expression wrong.

-- Randal L. Schwartz, Perl hacker

  • Comment on •Re: Re: •Re: Validating User Input

Replies are listed 'Best First'.
Re: •Re: Re: •Re: Validating User Input
by DamnDirtyApe (Curate) on Jun 11, 2002 at 14:49 UTC

    A ha! A small piece of regexp enlightenment, and a nifty trick with tr//c. Thanks merlyn! I see from my test cases that your pattern also matches an empty string... is there a way to handle that in the tr regexp, or would it be best to say something like <code>die if ( $answer =~ tr/a-zA-Z,//c or length $answer = 0 )<code>?


    _______________
    D a m n D i r t y A p e
    Home Node | Email