url_strip_fragment

url

Removes the fragment/anchor from a URL

Syntax

url_strip_fragment(url)

Parameters

url (string)

The URL string to modify

Returns

string

The URL without the fragment

Examples

Input:
url_strip_fragment("https://example.com/page#section")
Output:
"https://example.com/page"
Input:
url_strip_fragment("https://example.com/docs?search=value#results")
Output:
"https://example.com/docs?search=value"

The url_strip_fragment() function removes the fragment identifier (also called anchor or hash) from a URL, including the ”#” character and everything after it.

Usage

Use url_strip_fragment() when you need to clean URLs for canonical purposes, deduplication, or when fragments are not relevant for your analysis, such as normalizing URLs for counting unique page views.