Created
December 14, 2012 19:35
-
-
Save paganotoni/4287983 to your computer and use it in GitHub Desktop.
Counting Characters by type.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var pass = document.basic.password.value; | |
var chars = pass.length; | |
var l_let = pass.match(/[a-z]/g).length; | |
var u_let = pass.match(/[A-Z]/g).length; | |
var num = pass.match(/\d/g).length; | |
alert( | |
"# Chars: "+chars+"\n"+ | |
"# Lower: "+l_let+"\n"+ | |
"# Upper: "+u_let+"\n"+ | |
"# Numbers: "+num | |
); | |
//Source: http://forums.phpfreaks.com/topic/97635-count-number-of-lowercaseuppercasenumbers-in-a-string/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment