i know the reason, but i need some explanation, the reason is there’s no any \w* in second lookahead but why we need that \w* to pass the task? it’s problem for me because i think there’s already \w{6,} so why we need to use \w again??
\d{2,} - two ore more consecutive digits
Now lets decipher stuff with w
(?=\w*\d{2})
\w* - zero or more alphanumerics
\d{2} - two ore more consecutive digits
\w*\d{2} - zero or more alphanumerics followed by exactly two consecutive digits
Basically when we are talking about the whole expression:
/(?=\w{6,})(?=\w*\d{2})/
Consider it like two conditions. First condition in first parenthesis and second condition in the second.
When you are testing some string with it, string should pass both checks.
Makes sense?
your expression consists of two … subexpressions, let’s say
(?=\w{6,}) this one asks: “hey string, iwanna see that you have more than 5 alphanumerics in you”
(?=\w*\d{2}) this one asks:“hey string I also want something. I need you to be bunch of alphanumerics(zero or more) AND 2 digits after them”
To pass the tests your string should provide correct answer to both requests.
That was helpful for me, too. Just a couple days ago I was struggling with this regexp stuff. Try to decipher it from time to time, it helps to get better