Regular Expressions 101

Community Patterns

URL Extract base url (https://google.com) and domain (google.com) from URL String

0

Regular Expression
Python

r"
(?P<url>(?:https?:\/\/)?(?:[^@\/\n]+@)?(?:www\.)?(?P<domain>[^:\/?\n]+))/*.*
"
g

Description

For extracting the base URL and domain from a URL String

Submitted by QuickRegEx - 3 years ago