Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: regex elegance contest - validate a pw

by Roger (Parson)
on Feb 11, 2004 at 10:42 UTC ( [id://328219]=note: print w/replies, xml ) Need Help??


in reply to regex elegance contest - validate a pw

Ah, kvale has beaten me to the regex solution. Ok, I will post a slightly different one...
#!/usr/bin/perl -w # vim: set tabstop=3 use strict; while (<DATA>) { chomp; print "$_ .. "; if (m/^((?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9]).*)$ (??{ ! exists %{{qw! 5 0 6 0 7 0 8 0 !}}->{length($1)} })/x) { print "valid\n" } else { print "invalid\n" } } __DATA__ 1245Za78 1245Za7b8 45a7b8 a78Z 12Three kMdlOz 6KYX diImMU1Y ZNw4uWSht jDqvSN qVRR le2WTQv us1j3SerC OZv0LtSJ 9qyscg LbX7o74 80TeRHq 7YIiXnEV8 e1Yctl9 8iGoc R87MeDCFz ziTnlk cziP

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (7)
As of 2024-04-18 22:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found