Regex for password: repetative characters

前端 未结 4 1741
被撕碎了的回忆
被撕碎了的回忆 2020-12-22 06:59

I have following conditions for password validation.

Password must be at least eight (8) characters in length. Password must contain both alpha and numeric characte

4条回答
  •  南笙
    南笙 (楼主)
    2020-12-22 07:57

    The regex to match repeated characters is /(.)\1/.
    I would simply do this as a two-step verification, no need to roll it into one regex.
    As pointed out in the comments, this only lowers password entropy and thereby security though.

提交回复
热议问题