Hi I am developing one application in mvc5 with jquery. I am trying to implement regular expression for password as below. This is the piece of code from jquery.validationEngine-en.js
"requiredOutLogin": {
"regex":/^(?=.*[A-Z].*[A-Z])(?=.*[!@#$&*])(?=.*[0-9].*[0-9])(?=.*[a-z].*[a-z].*[a-z]).{8}$/,
"alertText": "*Password should contain atleast one special character,one number and one upper case letter",
"alertTextCheckboxMultiple": "* Please select an option",
"alertTextCheckboxe": "* This checkbox is required",
"alertTextDateRange": "* Both date range fields are required"
},
This is my razor view code.
@Html.TextBoxFor(model => model.usr_username, new { id = "txtusername", @maxlength = "15",@minlength="8",@class = "form-control validate[requiredOutLogin] text-input", @placeholder = "Username" })
I am not able to validate the password here. If i left blank the password field then it will popup required message(*Password should contain atleast one special character,one number and one upper case letter) but if i enter just test then it will login(if the password is correct). Above piece of regular expression not validation but it will display alertText if i keep the field blank. I copied regular expression from Regex to validate password strength. May I know why i am not able to validate here? Any help would be appreciated. Thank you.