in reply to How can I use all special characters in perl
I wrote a module to generate such regular expressions, but it's not yet available on CPAN. You can find it currently on Github at Regexp-PasswordValidation.
The approach of the regular expressions it creates is to generate one lookahead group for each required character from a set:
(?=(?:.*[A-Za-z].*){1}) # at least one of A-Za-z (?=(?:.*[0-9].*){1}) # at least one of 0-9 (?=(?:^.{8}$) # match exactly 8 charactters
... and so on.
Combining these gives:
qr/^ (?=(?:.*[A-Za-z].*){1}) # at least one of A-Za-z (?=(?:.*[0-9].*){1}) # at least one of 0-9 (?=(?:^.{8}$) # match exactly 8 charactters $ /x;
|
|---|