Regular Expressions 101

Community Patterns

Community Library Entry

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 - 4 years ago