Skip to content

Commit 569f27c

Browse files
committed
support ftp+rsync in extract_subdomain
1 parent 2b4b32b commit 569f27c

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/functions/extract_subdomain.cpp

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

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

test/sql/extract_subdomain.test

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,16 @@ SELECT extract_subdomain('https://b.a.example.com.ac:443/path');
7474
----
7575
b.a
7676

77+
query I
78+
SELECT extract_subdomain('rsync://rpki.example.com/path');
79+
----
80+
rpki
81+
82+
query I
83+
SELECT extract_subdomain('ftp://ftp1.example.com/path');
84+
----
85+
ftp1
86+
7787
query I
7888
SELECT extract_subdomain('com.ac');
7989
----

0 commit comments

Comments
 (0)