se vuoi impostare unlivello di sicurezza (3 condizioni su 4) potresti fare così
codice:var str = "0a$A00&c"; var re = []; re[0] = /[a-z]/ re[1] = /[A-Z]/ re[2] = /[0-9]/ re[3] = /\W/; var conditions = re.length; var securitylevel = 3; var passed = 0; while (conditions--) { if ((re[conditions]).test(str)) { ++passed }; }; if (passed >= securitylevel && str.length > 7) { alert('ok'); } else { alert('no'); }