URL Functions

These functions apply to MonetDB SQL type: URL (Uniform Resource Locator).
A URL string has a specific syntax, see URL syntax for valid URL string patterns.

FunctionReturn typeDescriptionExampleResult
getanchor(url)varcharextract the anchor part (after the #) from the url, may return null if no anchor existsSELECT getanchor( 'https://me:pw@ www.monetdb.org:458/Doc/Abc.html ?lang=nl&sort=asc#example' );example
getbasename(url)varcharextract the base name part (after the / excluding the extension) from the path of the url, may return nullSELECT getbasename( 'https://me:pw@ www.monetdb.org:458/Doc/Abc.html ?lang=nl&sort=asc#example' );Abc
getcontext(url)varcharextract the path context part of the urlSELECT getcontext( 'https://me:pw@ www.monetdb.org:458/Doc/Abc.html ?lang=nl&sort=asc#example' );/Doc/Abc.html
getdomain(url)varcharextract the top-level domain part of the host part of the url, may return nullSELECT getdomain( 'https://me:pw@ www.monetdb.org:458/Doc/Abc.html ?lang=nl&sort=asc#example' );org
getextension(url)varcharextract the file extension part of the url, may return nullSELECT getextension( 'https://me:pw@ www.monetdb.org:458/Doc/Abc.html ?lang=nl&sort=asc#example' );html
getfile(url)varcharextract the last file part of the path of the url, may return nullSELECT getfile( 'https://me:pw@ www.monetdb.org:458/Doc/Abc.html ?lang=nl&sort=asc#example' );Abc.html
gethost(url)varcharextract the host part of the url, may return nullSELECT gethost( 'https://me:pw@ www.monetdb.org:458/Doc/Abc.html ?lang=nl&sort=asc#example' );www\.monetdb.org
getport(url)varcharextract the port number part of the url, may return nullSELECT getport( 'https://me:pw@ www.monetdb.org:458/Doc/Abc.html ?lang=nl&sort=asc#example' );458
getprotocol(url)varcharextract the protocol or scheme part of the urlSELECT getprotocol( 'https://me:pw@ www.monetdb.org:458/Doc/Abc.html ?lang=nl&sort=asc#example' );https
getquery(url)varcharextract the query part (after the ?) of the url, may return nullSELECT getquery( 'https://me:pw@ www.monetdb.org:458/Doc/Abc.html ?lang=nl&sort=asc#example' );lang=nl&sort=asc
getroboturl(url)varcharextract the location of the robot control file of the urlSELECT getroboturl( 'https://me:pw@ www.monetdb.org:458/Doc/Abc.html ?lang=nl&sort=asc#example' );https://me:pw@www.monetdb .org:458/robots.txt
getuser(url)varcharextract the user part of the url, may return nullSELECT getuser( 'https://me:pw@ www.monetdb.org:458/Doc/Abc.html ?lang=nl&sort=asc#example' );me
isaurl(string)booleanchecks whether a character string complies to the url syntax formatSELECT isaurl( 'https://me:pw@ www.monetdb.org:458/Doc/Abc.html ?lang=nl&sort=asc#example' );true
newurl(scheme, authority, path)urlcreate a new url from three strings: scheme, authority or host and pathSELECT newurl( 'https', 'usr:pw@www.a.com:123', 'docs/index.html');https://usr:pw@www.a.com: 123/docs/index.html
newurl(scheme, host, int port, path)urlcreate a new url from three strings and a port number as third argumentSELECT newurl( 'https', 'www.a.com', 5567, 'docs/index.html');https://www.a.com: 5567/docs/index.html
url_extract_host( url string, no_www bool)varcharextract the host part of the url, may return nullSELECT url_extract_host( 'https://me:pw@ www.monetdb.org:458/Doc/Abc.html ?lang=nl&sort=asc#example', true);monetdb.org