clean_url(url)
Removes http://, ftp://, https://, the URL tail, and the last URL slash from a <url>.
CREATE OR REPLACE FUNCTION `justfunctions.eu.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>.''')
Example
SELECT `justfunctions.eu.clean_url`("https://hey.com/me/?231#213")
hey.com/me