split_url(url, part)
Splits a <url> into parts using the '/' symbol.
CREATE OR REPLACE FUNCTION `justfunctions.eu.split_url`(`url` STRING, `part` INT)
RETURNS STRING AS ((WITH split_parts as (
SELECT SPLIT("/" || TRIM(url,"/"), "/") split_str
)
SELECT split_str[safe_ordinal(part+1)]
from split_parts)
)
OPTIONS ( description = '''Splits a <url> into parts using the '/' symbol.''')
Example
SELECT `justfunctions.eu.split_url`("hey.com/me/?231#213", 2)
me