Many try to use Regular Expressions, but this is not the best way to evaluate password. Some things are surprisingly difficult or impossible to match using the Regex. At the same time, your criteria look very simple.
The algorithm you really need would be very simple, too. First, then length is known immediately:
string.Length
. Now, here is what you need to do. Create some local integer variables per the class of character. Say, one for upper-case letter, another for lower-case latter, one more for, say, punctuations, digits, etc. Initialize all of them to zero. Then loop through all the characters of the selected password string. For each character, check up if it belongs to one of the character class and increment corresponding variable.
In the loop, use
System.Char
methods to classify the current character:
http://msdn.microsoft.com/en-us/library/7f0ddtxh(v=vs.110).aspx[
^],
http://msdn.microsoft.com/en-us/library/yyxz6h5w(v=vs.110).aspx[
^],
http://msdn.microsoft.com/en-us/library/6w3ahtyy(v=vs.110).aspx[
^],
http://msdn.microsoft.com/en-us/library/d1x97616(v=vs.110).aspx[
^],
http://msdn.microsoft.com/en-us/library/9s91f3by(v=vs.110).aspx[
^], and so on…
On the exit from the loop, you will have complete number of characters in each class.
That's all. Simple, isn't it?
—SA