url_extract_protocol

url

Extracts the protocol/scheme from a URL

Syntax

url_extract_protocol(url)

Parameters

url (string)

The URL string to extract the protocol from

Returns

string

The protocol/scheme of the URL (e.g., "https", "http")

Examples

Input:
url_extract_protocol("https://example.com")
Output:
"https"
Input:
url_extract_protocol("http://example.com:8080/path")
Output:
"http"

The url_extract_protocol() function extracts the protocol (also called scheme) from a URL string, returning just the protocol portion without the ”://” separator.

Usage

Use url_extract_protocol() when you need to identify or filter URLs by their protocol, such as finding non-HTTPS URLs for security audits or grouping URLs by protocol type.