Skip to content

Commit 30f3637

Browse files
committed
support ftp and rsync in extract_domain
1 parent 30d7602 commit 30f3637

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/functions/extract_domain.cpp

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

3737
// Extract the host from the URL
38-
std::regex host_regex (R"(^(?:https?:\/\/)?([^\/\?:]+))");
38+
std::regex host_regex (R"(^(?:(?:https?|ftp|rsync):\/\/)?([^\/\?:]+))");
3939
std::smatch host_match;
4040
if (!std::regex_search (input, host_match, host_regex))
4141
{

test/sql/extract_domain.test

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,16 @@ SELECT extract_domain('com:443');
144144
----
145145
com
146146

147+
query I
148+
SELECT extract_domain('ftp://example.com/path');
149+
----
150+
example.com
151+
152+
query I
153+
SELECT extract_domain('rsync://rpki.example.com/path');
154+
----
155+
example.com
156+
147157
query I
148158
SELECT extract_domain('c');
149159
----
@@ -162,4 +172,4 @@ SELECT extract_domain('http:/example.com.ac/path');
162172
query I
163173
SELECT extract_domain('http:/example.com.ac:443/path');
164174
----
165-
(empty)
175+
(empty)

0 commit comments

Comments
 (0)