C# - Strong Password Regular Expression


^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[~!@#$%^&*_+=[{\]};:<>|.?,-]).{6,20}$


var hasMatchPasswordRegex = new Regex(service.GetGlobalSetUp().Rows[0]["password_regex"].ToString());
            if (!hasMatchPasswordRegex.IsMatch(change_password.NEW_PASSWORD))
            {
                response.status = HttpStatusCode.InternalServerError;
                response.statusText = " <strong>Fail</strong>"+ service.GetGlobalSetUp().Rows[0]["password_mis_match_message"].ToString();
                var resultOutput = JsonConvert.SerializeObject(response, Formatting.Indented,
                      new JsonSerializerSettings
                      {
                          ReferenceLoopHandling = ReferenceLoopHandling.Ignore
                      });
                return Json(resultOutput, JsonRequestBehavior.AllowGet);
            }


<p>* Password should equal or greater than 6 characters </p>
<p> * Password should contain At least one lower case letter.</p>
<p> * Password should contain At least one upper case letter.</p>
<p> * Password should contain At least one numeric value.</p>
<p>* Password should contain At least one special case characters</p> 

Comments

Popular posts from this blog

Provision AWS EC2 Instance and RDS with Terraform, and Deploy Spring Boot App to EC2 Instance via GitHub Action Pipeline

JQuery UI Autocomplete, custom HTML structure for result?

Easy Ui Jquery easyui-textbox change onChange event