SELECT `justfunctions.eu.clean_url`("https://hey.com/me/?231#213")
/*--Output--
hey.com/me
*/
CREATE OR REPLACE FUNCTION `your_project_id.your_dataset_id.clean_url`(`url` STRING)
RETURNS STRING AS (REGEXP_REPLACE(SPLIT(url,'?')[SAFE_OFFSET(0)],r'(https?|ftp):\/\/|\/$', ''))
OPTIONS ( description = '''Removes http://, ftp://, https://, the URL tail, and the last URL slash from a <url>.''')
SQL User Defined Function (SQL UDF)
See something wrong? Contact us or report an issue on Github.