PARSE_URL
Description
The PARSE_URL function is used to extract specific parts from a given URL. Depending on the specified partToExtract parameter, information such as the hostname, path, query parameters, reference, protocol, or filename can be extracted from the URL. Note that this function does not validate the URL's validity.
Parameters
- url (string type): The URL address to be parsed.
- partToExtract (string type): The part of the URL to extract. Possible values include: HOST, PATH, QUERY, REF, PROTOCOL, FILE.
- key (optional parameter, string type): When partToExtract is QUERY, this specifies the key name of the query parameter to extract.
Return Value
The function returns the extracted part of the URL, with the type being string.
Usage Example
The following examples demonstrate how to use the PARSE_URL function to extract different parts of the URL:
- Extract the hostname:
Result:
- Extraction Path:
Result:
- Extract Query Parameters:
Result:
- Extracting References:
Result:
5. Extraction Protocol:
Result:
- Extract the file name:
Result:
- Extract the query parameter value of a specific key:
Result: