IcEWaRRiOr_2002
@IcEWaRRiOr_2002

JS Регулярные выражения lookahead?

Застрял на задании в freeCodeCamp

Use lookaheads in the pwRegex to match passwords that are greater than 5 characters long, do not begin with numbers, and have two consecutive digits.


let sampleWord = "astronaut";
let pwRegex = /change/; // Change this line
let result = pwRegex.test(sampleWord);


Your regex should use two positive lookaheads.
Your regex should not match "astronaut"
Your regex should not match "banan1"
Your regex should match "bana12"
Your regex should match "abc123"
Your regex should not match "1234"
Your regex should not match "8pass99"
Your regex should not match "12abcde"
Your regex should match "astr1on11aut"
  • Вопрос задан
  • 116 просмотров
Решения вопроса 1
0xD34F
@0xD34F Куратор тега JavaScript
/(?=.*\d\d)^\D.{5,}$/
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы