Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: regex to deny characters?

by arrow (Friar)
on Dec 08, 2002 at 18:22 UTC ( [id://218380]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://218380]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-03-29 14:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found