Hi,
Try this:
Regex pass = new Regex("^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{4,8}$");
if(!pass.IsMatch(txtPassword.Text)){
}
else{
}
The following regular expression is for a 4 to 8 char password and containing at least an alphabet and one Number. You can change numbers in the end to your allowed password length.
--Amit