Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: regex elegance contest - validate a pw

by Anonymous Monk
on Feb 11, 2004 at 10:22 UTC ( [id://328213]=note: print w/replies, xml ) Need Help??


in reply to regex elegance contest - validate a pw

KISS. A single regex would not be clever
while (<DATA>) { chomp; print "\n$_\n"; if ( length() < 5 ) { print "too short\n" } elsif ( length() > 8 ) { print "too long\n" } elsif ( not /\d/ ) { print "need at least one digit\n" } elsif ( not /[a-z]/ ) { print "need at least one lowercase letter\n" } elsif ( not /[A-Z]/ ) { print "need at least one uppercase letter\n" } }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-19 21:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found