Are the regex /(?=\w{3,6})(?=\D*\d)/ equivalent to /(?=\w{3,6})(?=\d+)/?

Challenge: Regular Expressions - Positive and Negative Lookahead

Link to the challenge:

Tell us what’s happening:
In this challenge, there is the following example:

“A more practical use of lookaheads is to check two or more patterns in one string. Here is a (naively) simple password checker that looks for between 3 and 6 characters and at least one number:”

let password = "abc123";
let checkPass = /(?=\w{3,6})(?=\D*\d)/;
checkPass.test(password);

I was wondering if there are some differences between the following regex:

let checkPass1 = /(?=\w{3,6})(?=\D*\d)/;
let checkPass2 = /(?=\w{3,6})(?=\d+)/;

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.