c# - Regex password validation combination -


need regex please, have accomplished need 2 step process, have tried multiple rethinks unable make 2 regex's one. please point me in right direction? (have been through lots of tutorials, builders , not not seem clever enough figure out!)

this password validation, ensuring @ least 1 char, 1 number, 1 uppercase letter , ensuring first , last chars not digits , password @ least 8 chars long. server side version placing regex on client side too.

private bool validatepassword(string input) {     bool _return;     var regex = new regex(@"^(?=(.*\d))(?=.*[a-z])(?=.*[a-z])(?!\d).{8,}$");     _return = regex.ismatch(input);      if (_return)     {         regex = new regex(@"[^1](\d*)$");         _return = regex.ismatch(input);     }      return _return; } 

would work?

var regex = new regex(@"^(?=(.*\d))(?=.*[a-z])(?=.*[a-z])(?!\d).{7,}\d$"); 

demo here: http://rubular.com/r/xyisz3rcqr


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -