It's difficult for regular expressions to deal with stuff such as 'any three out four of conditions' using expressions of a reasonable length and you'd need alternators for each of the lookaheads in Jitendra's expression to do it properly.
If you don't need to do it using reglar expressions, then I'd do it using traditional string parsing which is relatively straightforward to do and executes quickly. I've assumed below that it's no problem if all four conditions are satisfied and not just any three:
using System;
class Test
{
static void Main()
{
string[] passWords = {"aX2#", "sed2T", "*v3X", "Ae234&B", "fg234", "g1HL","#1$23", "5a7%"};
foreach(string passWord in passWords)
{
bool b = ValidatePassword(passWord);
Console.WriteLine("'{0}' is{1} a valid password", passWord, b ? "": "n't");
}
Console.ReadKey();
}
static bool ValidatePassword(string passWord)
{
int validConditions = 0;
foreach(char c in passWord)
{
if (c >= 'a' && c <= 'z')
{
validConditions++;
break;
}
}
foreach(char c in passWord)
{
if (c >= 'A' && c <= 'Z')
{
validConditions++;
break;
}
}
if (validConditions == 0) return false;
foreach(char c in passWord)
{
if (c >= '0' && c <= '9')
{
validConditions++;
break;
}
}
if (validConditions == 1) return false;
if(validConditions == 2)
{
char[] special = {'@', '#', '$', '%', '^', '&', '+', '='}; // or whatever
if (passWord.IndexOfAny(special) == -1) return false;
}
return true;
}
}