SELECT `justfunctions.eu.extract_url_parameter`("www.google.com?medium=cpc&source=google&keyword=hey&source=facebook", "source")
/*--Output--
*/
CREATE OR REPLACE FUNCTION `your_project_id.your_dataset_id.extract_url_parameter`(`url` STRING, `parameter` STRING)
RETURNS STRING AS (REGEXP_EXTRACT(url, "[?&]" || parameter || "=([^&]+)"))
OPTIONS ( description = '''Extracts the value of a specified <parameter> from a <url>.''')
SQL User Defined Function (SQL UDF)
See something wrong? Contact us or report an issue on Github.