On Thu, Dec 13, 2001 at 02:36:38PM +0100, Bart Lateur wrote: > On Thu, 13 Dec 2001 14:29:14 +0100, Kim Schulz wrote: > >How short kan you make a program (oneliner?) that: > >* checks if a password is 5 characters long or more > >* checks if the password contains at least 3 alpha chars (a-zA-Z) > >* checks if the password contains at least 2 numbers (0-9) > > If a password contains at least 3 letters and 2 digits, than it has to > be at least 5 character long. Good point.
> /^(?=.*\d.*\d)(?=.*[a-z].*[a-z].*[a-z])/i y/A-Za-z/A-Za-z/>2&&y/0-9/0-9/>1 or the shorter $a=$_;y/A-Za-z//>2&&y/0-9//>1 that will mungle the password in $_ but keep a good copy in $a. > Short enough? No, but nice regexp (c: -Sven -- You will be called upon to help a friend in trouble.