Regular expressions about /(?=\D*\d)/

Should the code following be changed
" /(?=\w{3,6})(?=\D*\d)/"
" /(?=\w{3,6})(?=\d{1,})/"?
It really took me much time to understand the first line until I wrote down the second line, but I’m not sure if it is OK.
And another choice is
" /(?=\w{3,6})(?=\D*\d)/"
" /(?=\w{3,6})(?=\d\D*)/"?

Both of the choices I wrote are better understood, am I right? Anybody can help me confirm that? Thanks.

Your code so far

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

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.88 Safari/537.36

Challenge: Positive and Negative Lookahead

Link to the challenge:

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