no when they are used both in this excercice , why they used it?
i gave my own solution and it passed all the tests except the one where it should match the string 12345, my solution was similar to the hint solution except that my solution doesn’t have the \w*, I wonder why I want to check for longest consecutive alphanumeric patters in the string 12345 where I specified in my regex the positive lookahead (?=\w{2,}), you see what I mean?
or I don’t get how regexes work because all the past challenges of js were easy to me except the regular expression section, it’s a weird bunch of lessons. is it just me?
What is your solution exactly? My understanding of (?=\w*\d{2}) :
* means “zero or more” \w* means “zero or more alphanumeric characters” \w*\d{2} means “two consecutive numbers with zero or more alphanumeric characters before them”
WIthout the \w* included in \d{2} will only match two numbers at the beginning of the string (e.g. 82elliot) but not if there are any leading letters (e.g. el82liot)
RegEx is hard for me too, I use the website https://regex101.com/ to test and reference.
See, i though each of the 2 lookaheads look for each half the string, i relused that each lookahead look into all the string and now what you say make sense.
My issue overall with regexs is that i don’t know when parts of the my long regex for example, will it work on half of the string or all the string… I think it’s because i work in the day and code at night my brain powers are insufficient as for when i started to code last year i was unemployed and free.
Anyway think you.