I have written a regular expression which could potentially be used for password strength validation:
^(?:([A-Z])*([a-z])*(\\d)*(\\W)*){8,12}$
I think you'll have to check each group independently. Pseudo-code:
bool[] array = {}; array[0] = pwd.match(/[A-Z]/); array[1] = pwd.match(/[a-z]/); array[2] = pwd.match(/\d/); array[3] = pwd.match(/[!_.-]/); int sum = 0; for (int i=0; i