A
ajs
I wrote a program that generates passwords (
http://www.ajs.com/~ajs/mkpasswd.html for those who are curious ), and
was discussing it with someone who asked if it could restrict its
results to those that alternate sides of the keyboard. This is a
feature I've been mulling for a while, but I suggested to him that he
could just generate many passwords, and filter them using grep or perl
or whatever. The pattern I suggested was (I'll use Perl here):
m{ ^
(([12345qwertasdfgzxcvb][67890\-yuiophjkl;nm,./])*
|
([67890\-yuiophjkl;nm,./][12345qwertasdfgzxcvb])*)
$ }xi
But that feels wrong to me... it seems as if there should be some
shorter way to express that. Any regexp golfers want to take a swing?
Obviously I could have:
$left = qr{[12345qwertasdfgzxcvb]}i;
$right = qr{[67890\-yuiophjkl;nm,./]}i;
m{^(($left$right)*|($right$left)*)$};
but that's not quite the same as coming up with a shorter pattern.
Note that that's not ALL of the characters. I've left out a bunch of
punctuation for brevity, but you get the idea.
PS: I'm using the new Google Groups to try it out. If it eats my
formatting, above... well, sorry.
http://www.ajs.com/~ajs/mkpasswd.html for those who are curious ), and
was discussing it with someone who asked if it could restrict its
results to those that alternate sides of the keyboard. This is a
feature I've been mulling for a while, but I suggested to him that he
could just generate many passwords, and filter them using grep or perl
or whatever. The pattern I suggested was (I'll use Perl here):
m{ ^
(([12345qwertasdfgzxcvb][67890\-yuiophjkl;nm,./])*
|
([67890\-yuiophjkl;nm,./][12345qwertasdfgzxcvb])*)
$ }xi
But that feels wrong to me... it seems as if there should be some
shorter way to express that. Any regexp golfers want to take a swing?
Obviously I could have:
$left = qr{[12345qwertasdfgzxcvb]}i;
$right = qr{[67890\-yuiophjkl;nm,./]}i;
m{^(($left$right)*|($right$left)*)$};
but that's not quite the same as coming up with a shorter pattern.
Note that that's not ALL of the characters. I've left out a bunch of
punctuation for brevity, but you get the idea.
PS: I'm using the new Google Groups to try it out. If it eats my
formatting, above... well, sorry.