extract_url_domain_base(url)
Extracts the base domain from a <url>.
CREATE OR REPLACE FUNCTION `justfunctions.eu.extract_url_domain_base`(`url` STRING)
RETURNS STRING AS (REPLACE (NET.REG_DOMAIN(url), CONCAT('.',NET.PUBLIC_SUFFIX(url)),""))
OPTIONS ( description = '''Extracts the base domain from a <url>.''')
Example
SELECT `justfunctions.eu.extract_url_domain_base`("https://hey.com/me/?231#213")
hey