### strings.extract_domain

Supported in:

    strings.extract_domain(url_string)

#### Description

Extracts the domain from a string.

> [!NOTE]
> **Note:** The function does not perform Unicode normalization.

> [!NOTE]
> **Note:** The public suffix data at publicsuffix.org also contains private domains. This function does not treat a private domain as a public suffix. For example, if us.com is a private domain in the public suffix data, ("foo.us.com") returns us.com (the public suffix com plus the preceding label us) rather than foo.us.com (the private domain us.com plus the preceding label foo).

> [!NOTE]
> **Note:** The public suffix data might change over time. Consequently, input that produces default empty value now may produce a non-empty value in the future.

#### Param data types

`STRING`

#### Return type

`STRING`

#### Code samples

##### Example 1

This example shows an empty string

    strings.extract_domain("") = ""

##### Example 2

random string, not a URL

    strings.extract_domain("1234") = ""

##### Example 3

multiple backslaches

    strings.extract_domain("\\\\") = ""

##### Example 4

non-alphabet characters handled gracefully

    strings.extract_domain("http://例子.卷筒纸.中国") = "卷筒纸.中国"

##### Example 5

handling URIs

    strings.extract_domain("mailto:?to=&subject=&body=") = ""

##### Example 6

multiple characters before actual URL

    strings.extract_domain("     \t   !$5*^)&dahgsdfs;http://www.google.com") = "google.com"

##### Example 7

special characters in URI `#`

    strings.extract_domain("test#@google.com") = ""

##### Example 8

special characters in URL `#`

    strings.extract_domain("https://test#@google.com") = ""

##### Example 9

positive test case

    strings.extract_domain("https://google.co.in") = "google.co.in"