php - Regular expression - avoid the repetition of the sequence of the same letters -


I'm trying to do a check on a password entered by a user working on a PHP website. Less than 8 characters

  • Maximum of 20 characters
  • I want to accept letters, numbers and common special characters like (dot) @ I + $ - _!
  • By this point I have been able to find the correct expression, but now I want to add another rule, where the user can not do the same sequence of letters and Write 1 time.

    We say that, do not consider duplication of the same letter twice, if the user writes the same string (equal to or more than 3 characters) once again, For example:

    • abcde not valid - Must be at least 8 characters No

      / Li>
    • abcde1234 Valid string abcd1
    • abababab not valid - string "now" 2 times or more
    • aaaaaaaa not valid - Ring AAA has changed over
    • helloworld valid - even if letter "l" was repeated twice

    Any suggestions? I do not know that it is possible to write the correct RegExp, maybe I'm trying to do something unlikely.
    Before leaving the idea, I was curious to know about someone who wanted to know more about RegExp.
    Thanks in advance

      ^ (?!. *? (+. +) \ 1 ) ([\ W = + $!!]] + $ 8,20} $  

    works well:

    hard part which is "the beginning of the input, when it is not followed: some, then some substring, then once sub-object".

    It is being said that all "password verification" is a very nonsensical enterprise, which in reality prevents people from using it.


    Comments

    Popular posts from this blog

    apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

    c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

    c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -