RegEx for Password Validation (ASP)

前端 未结 3 645
北荒
北荒 2020-12-10 21:58

Can someone suggest a regular expression for validating a password with the following conditions.

  • Password must be at least 12 characters long
  • Passwo
3条回答
  •  無奈伤痛
    2020-12-10 22:11

    When all you have is a hammer eh?

    Seriously though, using a regex is not really the correct answer here. If you're dead set on using regexes, then at least break it up into multiple cases and evaluate each individually.

    If it were me, I'd just write a set of simple functions that check each case. Eg: one for upper/lower case, one for number, one for special symbols, then a main routine that checks that all your requirements are met. As FailedDev mentioned above, a single regex to handle all these cases would be a pain to both write AND maintain..

提交回复
热议问题