Skip to main content

EXTRACT_URL_PARAMETER

Description

Returns the value of the name parameter in the URL, if it exists, or an empty string otherwise.

If there are multiple parameters with this name, the first one that occurs is returned.

This function works assuming that the parameter name is encoded in the URL exactly as it is in the passed parameter.

If you want to get other parts of the URL, you can use parse_url

Syntax

EXTRACT_URL_PARAMETER ( <url> , <name> )

Parameters

ParametersDescription
<url>The url string of the parameter to be returned
<name>The name of the parameter to be returned

Return Value

The value of the parameter <name> in <url>

Example

SELECT EXTRACT_URL_PARAMETER("http://doris.apache.org?k1=aa&k2=bb&test=cc#999", "k2")
+--------------------------------------------------------------------------------+
| extract_url_parameter('http://doris.apache.org?k1=aa&k2=bb&test=cc#999', 'k2') |
+--------------------------------------------------------------------------------+
| bb |
+--------------------------------------------------------------------------------+