Extract Domains


My Code:

pattern = r'[Hh][Tt][Tt][Pp][Ss]?://([^/?]+)'
domains = hn['url'].str.extract(pattern)

Not sure why it is not correct since the test case does not give me the incorrect part

1 Like

Hello @zhangyongheng78 Welcome to the community, please provide mission link with it.

Hi. It is data science track, step 2, advanced data cleaning, advanced regular expression, screen 8

You can see on PythonEx where its failing i dont know much about RegEx. but i hope this will help you to troubleshoot until someone explain and give solution. Test RegEx - PythonEx

PS: Mission link extracting-domains-from-urls