Please tell me the regular expression to search for at least 2 letters per line. Letters can be located anywhere, do not have to go under the hood.

  • Letters may not necessarily be repeated, so the register is not important, and so on. The main thing is that there should be at least 2 in a row, and no matter what and in what order they are located. Example (javascript): / regular / i.test ('w89u7'); / * should return true * / / regular / i.test ('; Te153#-00'); / * should return true * / - cyberd0g
  • Solutions found: /(?=(?:.*?[az){2} )/i /.*?[az[.*?[az[.*/i - cyberd0g

2 answers 2

It is possible so:

.*(\w).*(\1.*)+ 

Demo: http://jsfiddle.net/coder13/Q4jL7/

  • It seems not necessarily the same letters? - VladD
  • @VladD: Well, I logically reasoned. Usually they are looking for duplicates, but the phrase “it’s not necessary to go undermine,” speaks for itself. - Pavel Azanov 6:01 pm

Solution found: (?=(?:.*?[a-zA-Z]){2})

  • Transformed your comment into an answer, accept to close the question. - Pavel Azanov
  • 3
    Why is it so difficult then? Why not just \w.*\w ? - VladD
  • one
    And the most productive option for completeness :) \ w \ W * + \ w - ReinRaus