in reply to regex to deny characters?

gjb and newrisedesigns, you did have me wrong. I needed at least one lower case letter and the ability to accept an optional hypen or space. In other words:
sdlfj   OK
dsfj-dlf   OK
dish dslf   OK
dsf-ldj sdf   OK
-   NOT OK
 (space character)   NOT OK
*$)#&%_!@...   NOT OK

Just Another Perl Wannabe

Replies are listed 'Best First'.
(z) Re^2: regex to deny characters?
by zigdon (Deacon) on Dec 09, 2002 at 14:44 UTC
    OK, so you were pretty close:
    while (<DATA>) { chomp; print "$_ "; if (/^[a-z][a-z \-]*/) { print "OK\n"; } else { print "NOT OK\n"; } } __DATA__ sdlfj dsfj-dlf dish dslf dsf-ldj sdf - *$)#&%_!@...

    -- Dan