Regular Expression for Password Validation C#

后端 未结 3 646
面向向阳花
面向向阳花 2021-01-24 02:50

I want to validate a password using regular expression in c#.

These are the conditions :

  1. should not start with digit or special character
  2. should n
3条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-24 03:10

    Give this a whirl

    ^(?i)(?=.*[a-z])(?=.*[0-9])(?=.*[@#_])[a-z][a-z0-9@#_]{6,}[a-z0-9]$
    

    Fits your specification I believe. From the look of your current regex youll be able to understand it but if not comment and ill explain.

提交回复
热议问题