in reply to Removing similar characters
Regex will surely be your friend here. Do you want to remove from the string, replace them with new random chars, or throw out the password entirely and regenerate a new random string?
I would use character classes for each set of things you want to be track duplicates for, with something like the below.
my $password = 'a8f3%djk$'; # some random string if ($password =~ m/[[:alpha:]]{3,}|\d{3,}|[\^@\(]{3,}/) { # regenerate password }
You could use a character class like [A-Za-z] instead of [[:alpha:]] if you know you will only see ascii character. You will likely have to add to the [\^@\(] character class any other symbols you want. The other option is to exclude anything you don't want to match in that class. Maybe [^0-9A-Za-z] is enough there.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Removing similar characters
by rspishock (Monk) on Sep 01, 2011 at 22:41 UTC | |
by Kc12349 (Monk) on Sep 02, 2011 at 12:47 UTC |