Functions for working with URLs

**Examples**

**Usage example**

```
SELECT topLevelDomain('svn+ssh://www.some.svn-hosting.com:80/repo/trunk');
```

```
┌─topLevelDomain('svn+ssh://www.some.svn-hosting.com:80/repo/trunk')─┐
│ com                                                                │
└────────────────────────────────────────────────────────────────────┘
```

## topLevelDomainRFC[​](#topLevelDomainRFC "Direct link to topLevelDomainRFC")

Introduced in: v22.10.0

Extracts the the top-level domain from a URL.
Similar to [`topLevelDomain`](#topLevelDomain), but conforms to [RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986).

**Syntax**

```
topLevelDomainRFC(url)
```

**Arguments**

- `url` — URL. [`String`](/docs/sql-reference/data-types/string)

**Returned value**

Domain name if the input string can be parsed as a URL. Otherwise, an empty string. [`String`](/docs/sql-reference/data-types/string)

**Examples**

**Usage example**

```
SELECT topLevelDomain('http://foo:foo%[email protected]'), topLevelDomainRFC('http://foo:foo%[email protected]');
```

```
┌─topLevelDomain('http://foo:foo%[email protected]')─┬─topLevelDomainRFC('http://foo:foo%[email protected]')─┐
│                                                │ com                                               │
└────────────────────────────────────────────────┴───────────────────────────────────────────────────┘
```

- [Overview](#overview)- [URLHierarchy](#URLHierarchy)- [URLPathHierarchy](#URLPathHierarchy)- [cutFragment](#cutFragment)- [cutQueryString](#cutQueryString)- [cutQueryStringAndFragment](#cutQueryStringAndFragment)- [cutToFirstSignificantSubdomain](#cutToFirstSignificantSubdomain)- [cutToFirstSignificantSubdomainCustom](#cutToFirstSignificantSubdomainCustom)- [cutToFirstSignificantSubdomainCustomRFC](#cutToFirstSignificantSubdomainCustomRFC)- [cutToFirstSignificantSubdomainCustomWithWWW](#cutToFirstSignificantSubdomainCustomWithWWW)- [cutToFirstSignificantSubdomainCustomWithWWWRFC](#cutToFirstSignificantSubdomainCustomWithWWWRFC)- [cutToFirstSignificantSubdomainRFC](#cutToFirstSignificantSubdomainRFC)- [cutToFirstSignificantSubdomainWithWWW](#cutToFirstSignificantSubdomainWithWWW)- [cutToFirstSignificantSubdomainWithWWWRFC](#cutToFirstSignificantSubdomainWithWWWRFC)- [cutURLParameter](#cutURLParameter)- [cutWWW](#cutWWW)- [decodeURLComponent](#decodeURLComponent)- [decodeURLFormComponent](#decodeURLFormComponent)- [domain](#domain)- [domainRFC](#domainRFC)- [domainWithoutWWW](#domainWithoutWWW)- [domainWithoutWWWRFC](#domainWithoutWWWRFC)- [encodeURLComponent](#encodeURLComponent)- [encodeURLFormComponent](#encodeURLFormComponent)- [extractURLParameter](#extractURLParameter)- [extractURLParameterNames](#extractURLParameterNames)- [extractURLParameters](#extractURLParameters)- [firstSignificantSubdomain](#firstSignificantSubdomain)- [firstSignificantSubdomainCustom](#firstSignificantSubdomainCustom)- [firstSignificantSubdomainCustomRFC](#firstSignificantSubdomainCustomRFC)- [firstSignificantSubdomainRFC](#firstSignificantSubdomainRFC)- [fragment](#fragment)- [netloc](#netloc)- [path](#path)- [pathFull](#pathFull)- [port](#port)- [portRFC](#portRFC)- [protocol](#protocol)- [queryString](#queryString)- [queryStringAndFragment](#queryStringAndFragment)- [topLevelDomain](#topLevelDomain)- [topLevelDomainRFC](#topLevelDomainRFC)

Was this page helpful?