Description
Extracts a specified part from a URL field.
Syntax
ExtractUrlPart(url, url_part)
Arguments
url - string expression indicating a url
url_part - string with these possible values to retrieve the corresponding component of the url:
- scheme or protocol returns protocol identifier
- host returns host name
- port returns port number
- path returns path
- query returns query
- ref or fragment returns reference
Examples
ExtractUrlPart('http://someurl.com:80/path1/path2/file.html?origin=135#PORTION1', 'protocol')
returns: 'http'
ExtractUrlPart('http://someurl.com:80/path1/path2/file.html?origin=135#PORTION1', 'host')
returns: 'someurl.com'
ExtractUrlPart('http://someurl.com:80/path1/path2/file.html?origin=135#PORTION1', 'port')
returns: '80'
ExtractUrlPart('http://someurl.com:80/path1/path2/file.html?origin=135#PORTION1', 'path')
returns: 'path1/path2/file.html'
ExtractUrlPart('http://someurl.com:80/path1/path2/file.html?origin=135#PORTION1', 'query')
returns: 'origin=135'
ExtractUrlPart('http://someurl.com:80/path1/path2/file.html?origin=135#PORTION1', 'fragment')
returns: 'PORTION1'
Return value datatype
String
Notes
If the specified part is not supported an exception is thrown.
Impact of null value
If any (or all) inputs are null, or the specified part is not present in the url or an exception is thrown, returns null.