Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Regular expression to check for qwerty sequence in a password

by tybalt89 (Vicar)
on Oct 09, 2016 at 13:44 UTC ( #1173589=note: print w/replies, xml ) Need Help??


in reply to Regular expression to check for qwerty sequence in a password

#!/usr/bin/perl -l # http://perlmonks.org/?node_id=1173584 use strict; use warnings; my $password ="asdf"; my $sequences = "qwertyuiop\nasdfghjkl\nzxcvbnm"; if( "$password\0$sequences" =~ /(.{3}).*\0.*\1/s ) { print 'no sequences allowed!'; } else { print "password is okay"; }

Replies are listed 'Best First'.
Re^2: Regular expression to check for qwerty sequence in a password
by bradcathey (Prior) on Oct 09, 2016 at 16:23 UTC

    Interesting. Of course, it works, but I'm not sure what is happening with the:

    "$password\0$sequences"

    and the subsequent:

    \0

    in the regex. I've not see this before and am curious. Thoughts?

    —Brad
    "The important work of moving the world forward does not wait to be done by perfect men." George Eliot

      I use the \0 as a marker or separator between the two sections of the string' Then I match for a three letter sequence that occurs before the marker, some characters, the marker, some characters, and finally the exact three letter sequence that was matched on the left of the marker. If the regex can match, then there is a three letter sequence in the password that matches exactly three keyboard letters in a row.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2018-11-12 20:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My code is most likely broken because:
















    Results (144 votes). Check out past polls.

    Notices?