Is there an easy way to decode URLs in the BigQuery query language? I am working with a table in which there is a column containing rows encoded with URLs in some values. For instance:
http://xyz.com/example.php?url=http%3A%2F%2Fwww.example.com%2Fhello%3Fv%3D12345&foo=bar&abc=xyz
I retrieve the url parameter as follows:
SELECT REGEXP_EXTRACT(column_name, "url=([^&]+)") as url from [mydataset.mytable]
which gives me:
http%3A%2F%2Fwww.example.com%2Fhello%3Fv%3D12345
What I would like to do is something like:
SELECT URL_DECODE(REGEXP_EXTRACT(column_name, "url=([^&]+)")) as url from [mydataset.mytable]
thereby returning:
http:
I would like to avoid using multiple REGEXP_REPLACE () statements (replacing% 20,% 3A, etc.) if possible.
Ideas?
source share