Tags:369-8 no '?' after '-' solution question

Screen Link:
https://app.dataquest.io/m/369/advanced-regular-expressions/8/extracting-domains-from-urls

The solution for the pattern in 369-8 is pattern = r"https?://([\w\-\.]+)"
Why does this work even without a ‘?’ after the ‘-’ when only css-cursor has a dash in the domain name? I thought the pattern should be pattern = r"https?://([\w\-?\.]+)"

Hi @vroomvroom,

Try finding out what the […] syntax stands for. I believe you can do this on your own :v:

I like this link to check.

4 Likes

a related issue, how does this correct answer code know to stop when it reaches the / character? if i were to script out the capture brackets, would it say something like:
“any word character, hyphen, or period, plus then next one, until the next character isnt a word character, hyphen or dot” ?

so in a different situation, a white space would also end this capture, correct? thanks!