I am trying to replace our password validation with a simple RegEx in my asp.net project which uses regularexpression validator.
Here is the password restrictions:
- Password should be of minimum 6 chars in length and maximum 15
- It should have at least one letter (any case)
- It should have at least one digit
- It should have at least one special character.
I am n00b at regex and this is the only type of question where i ask for spoon feeding ;)
I tried below regex but it fails in few cases.
string re1="([a-z])"; // Any Single Word Character (Not Whitespace) 1
string re2=".*?"; // Non-greedy match on filler
string re3="."; // Uninteresting: c
string re4=".*?"; // Non-greedy match on filler
string re5="."; // Uninteresting: c
string re6=".*?"; // Non-greedy match on filler
string re7="(.)"; // Any Single Character 1
string re8="(\\d)"; // Any Single Digit 1
Regex r = new Regex(re1+re2+re3+re4+re5+re6+re7+re8,RegexOptions.IgnoreCase|RegexOptions.Singleline);
Match m = r.Match(txt)