Extracting Domains Using RegEx Problem

Screen Link:

My Code:

r"https?:// ([\w\-\.]+) "

I’m trying to extract Domain names from Url. Regex equation above is the solution for this exercise. Can someone please help me understand what is happening inside this capture group.

From my understanding of sets either one of the elements in set will be matched (either ‘\w’ or ‘-’ or ‘.’) but, how come using this solution is matching all 3 elements in this set.??

Well, I think the trick goes to the little plus sign at the end of the capture group :slight_smile:
it means “Match One or more times”

The logic is correct , but the error is in the syntax:
r"https?:// ([\w-.]+) "
u have put a space between:// and the first char \w
i.e. like https:// www.valid.ly ?param. If u closely look then there is the space between domain name and ? also thus this is not the matching with any domain as their is no space between them otherwise the logic is correct and the correct syntax would be: