
Kanji
User
/ Moderator
Jul 28, 2000, 9:10 AM
Post #4 of 5
(7932 views)
|
<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> for ( $password ) { length > 8 or die "Not long enough\n"; /[A-Z]/ or die "Must contain at least one capital\n"; /[a-z]/ or die "Must contain at least one lower\n"; /[0-9]/ or die "Must contain at least one number\n"; /(.)\1\1/ and die "$1 is repeated too many times\n"; /(.{2,}).*\1/ and die "$1 is repeated too many times\n"; }</pre><HR></BLOCKQUOTE> In the above, the first repetition check disallows antyhing with three identical and consecutive characters. Add or remove more \1's if you prefer that limit be higher or lower. Similiarly, the second repetition check disallows anything that contains duplicate strings of two or more characters. Increase or decrease the number 2 to raise or drop the minimum number of characters you consider to be a string. ie, {3,} would be three or more, etc.
|