Community Patterns

Community Library Entry

0

Regular Expression
Created·2018-10-15 13:57
Flavor·Golang

`
^(?:https?:)?(?:\/\/)?(?:[^@\n]+@)?(?:www\.)?([^:\/\n]+)
`
gm
Open regex in editor

Description

Regular expression ^(?:https?:)?(?://)?(?:[^@\n]+@)?(?:www.)?([^:/\n]+) used below extracts domain with subdomains out of a full url. It skips protocol (ex: https:), "//", "@", www subdomain and then captures everything (ex: domain) before ":" or "/" or end of line.

Submitted by anonymous