SELECT `justfunctions.eu.extract_email_domain_base`("[email protected]")
/*--Output--
justdataplease
*/
CREATE OR REPLACE FUNCTION `your_project_id.your_dataset_id.extract_email_domain_base`(`url` STRING)
RETURNS STRING AS (REPLACE (NET.REG_DOMAIN(url), CONCAT('.',NET.PUBLIC_SUFFIX(url)),""))
OPTIONS ( description = '''Extracts the base domain from an <email>.''')
SQL User Defined Function (SQL UDF)
See something wrong? Contact us or report an issue on Github.