strings.extract_subdomains
Supported in:
strings.extract_subdomains(url_string)
Description
Extracts all subdomains found in a URL string.
Param data types
STRING
Return type
ARRAY_STRINGS
Code samples
Example 1
This example shows how to extract the subdomains from a URL string.
strings.extract_subdomains("www.sub1.sub2.google.com") = ["www", "sub1", "sub2"]
Example 2
This example shows how to extract subdomains when using non ASCII characters.
strings.extract_subdomains("http://例子.卷筒纸.中国") = ["例子"]
Example 3
This example shows handling of a non URL string.
strings.extract_subdomains("three nine four") = []
Example 4
This example shows handling of an unregistered domain.
strings.extract_subdomains("http://localhost:80") = []
Example 5
This example shows handling of a multi part suffix.
strings.extract_subdomains(" www.Example.Co.UK ") = ["www"]