Why loop when you can make regex loop for you :)
#!/usr/bin/perl -l # http://perlmonks.org/?node_id=1173584 use strict; use warnings; my $sequences = "qwertyuiop asdfghjkl zxcvbnm"; my @threes; push @threes, $1 while $sequences =~ /(?=(\w{3}))/g; my $invalid = do { local $" = '|'; qr/@threes/ }; my $password ="asdf"; if( $password =~ $invalid ) { print 'no sequences allowed!'; } else { print "password is okay"; }
In reply to Re^2: Regular expression to check for qwerty sequence in a password
by tybalt89
in thread Regular expression to check for qwerty sequence in a password
by bradcathey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |