It'll take a fair whack of processing power to check everything but at least you can clean it up along the way thad0ctor - nested if/ loop checks would be most appropriate I should think:
Code:
crunch | while read $line {
if ( moreThan2Same( $line ) ) {
break; # One condition has been failed, so we can bail. The how many instances loop is going to be quicker than consec characters, so we put it first.
} else {
if ( consecCharacters( $line ) > 2 ) {
break; # 3 or more consec characters is not random enough. This gives us pattern checks with trinomials - 123, 234, 345, 456, 567, 678, 789, 890, etc.
} else {
# additional if/else checks.
print $line;
}
}
}
If you start with the most efficient checks (string length, counting characters, then consec characters asc, consec characters desc, then whatever), you'll reduce the processing power somewhat significantly.