SELECT `justfunctions.eu.extract_url_domain_base`("https://hey.com/me/?231#213")
/*--Output--
hey
*/
CREATE OR REPLACE FUNCTION `your_project_id.your_dataset_id.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>.''')
SQL User Defined Function (SQL UDF)
See something wrong? Contact us or report an issue on Github.