Skip to content

Commit 5b4dc75

Browse files
committed
support ftp+rsync in extract_tld
1 parent 01ae37b commit 5b4dc75

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/functions/extract_tld.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace duckdb
3030
Connection con (db);
3131

3232
// Extract the host from the URL
33-
std::regex host_regex (R"(^(?:https?:\/\/)?([^\/\?:]+))");
33+
std::regex host_regex (R"(^(?:(?:https?|ftp|rsync):\/\/)?([^\/\?:]+))");
3434
std::smatch host_match;
3535
if (!std::regex_search (input, host_match, host_regex))
3636
{

test/sql/extract_tld.test

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,16 @@ SELECT extract_tld('https://example.com.ac:443/path/path');
124124
----
125125
com.ac
126126

127+
query I
128+
SELECT extract_tld('ftp://ftp.example.com/path/path');
129+
----
130+
com
131+
132+
query I
133+
SELECT extract_tld('rsync://rpki.example.com/path/path');
134+
----
135+
com
136+
127137

128138
query I
129139
SELECT extract_tld('com.ac');

0 commit comments

Comments
 (0)