Skip to content

Commit 56a7503

Browse files
committed
docs: add extract_extension function
1 parent 625ec05 commit 56a7503

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Table of Contents
1717
- [Extracting The Schema](#extracting-the-schema)
1818
- [Extracting The Query](#extracting-the-query)
1919
- [Extracting The Port](#extracting-the-port)
20+
- [Extracting The File Extension](#extracting-the-file-extension)
2021
- [Extracting The TLD (Top-Level Domain)](#extracting-the-tld-top-level-domain)
2122
- [Extracting The Sub Domain](#extracting-the-sub-domain)
2223
- [Get Tranco Rank](#get-tranco-rank)
@@ -208,6 +209,20 @@ D SELECT extract_port('[::1]:6379') AS port;
208209
└─────────┘
209210
```
210211

212+
### Extracting The File Extension
213+
214+
This function extracts the file extension from a URL. It will return the file extension without the dot.
215+
216+
```sql
217+
D SELECT extract_extension('http://example.com/image.jpg') AS ext;
218+
┌─────────┐
219+
│ ext │
220+
varchar
221+
├─────────┤
222+
│ jpg │
223+
└─────────┘
224+
```
225+
211226
### Extracting The TLD (Top-Level Domain)
212227

213228
This function extracts the top-level domain from a URL. This function will use the public suffix list to extract the TLD. Check the [Extracting The Main Domain](#extracting-the-main-domain) section for more information about the public suffix list.
@@ -373,7 +388,6 @@ D select * from netquack_version();
373388
## Roadmap 🗺️
374389

375390
- [ ] Create a `TableFunction` for `extract_query_parameters` that return each key-value pair as a row.
376-
- [ ] Implement `extract_port` function
377391
- [ ] Implement `extract_custom_format` function
378392
- [ ] Implement `parse_uri` function
379393
- [ ] Save Tranco data as Parquet

docs/functions/extract_extension.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
layout:
3+
title:
4+
visible: true
5+
description:
6+
visible: false
7+
tableOfContents:
8+
visible: true
9+
outline:
10+
visible: true
11+
pagination:
12+
visible: true
13+
---
14+
15+
# Extract File Extension
16+
17+
This function extracts the file extension from a URL. It will return the file extension without the dot.
18+
19+
```sql
20+
D SELECT extract_extension('http://example.com/image.jpg') AS ext;
21+
┌─────────┐
22+
│ ext │
23+
varchar
24+
├─────────┤
25+
│ jpg │
26+
└─────────┘
27+
28+
D SELECT extract_extension('https://site.com/download.exe?source=official') AS ext;
29+
┌─────────┐
30+
│ ext │
31+
varchar
32+
├─────────┤
33+
│ exe │
34+
└─────────┘
35+
```

0 commit comments

Comments
 (0)