The best way is to take an existing plugin as TJB suggested.
As to your question about the code itself, a nicer way is to write it like that:
var pass = "f00Bar!";
var strength = 1;
var arr = [/.{5,}/, /[a-z]+/, /[0-9]+/, /[A-Z]+/];
jQuery.map(arr, function(regexp) {
if(pass.match(regexp))
strength++;
});
(Modified to correct syntax errors.)