url_extract_domain

url

Extracts the domain from a URL

Syntax

url_extract_domain(url)

Parameters

url (string)

The URL string to extract the domain from

Returns

string

The domain portion of the URL

Examples

Input:
url_extract_domain("https://www.example.com/path")
Output:
"www.example.com"
Input:
url_extract_domain("https://api.example.com:8080/endpoint")
Output:
"api.example.com"

The url_extract_domain() function extracts the domain (hostname) from a URL string, returning only the domain portion without protocol, port, path, or query parameters.

Usage

Use url_extract_domain() when you need to analyze or group URLs by domain, such as counting visits per domain in access logs or filtering URLs from specific domains.