Repository navigation
v0.1.0 - Initial Release
DuckDB URLPattern Extension v0.1.0
Initial release of the URLPattern extension for DuckDB, implementing the WHATWG URLPattern API.
Features
- Custom URLPATTERN type with validation and implicit casting from VARCHAR
- Pattern matching:
urlpattern_test(pattern, url)- test if a URL matches a pattern - Group extraction:
urlpattern_extract(pattern, url, group_name)- extract named groups - Full match results:
urlpattern_exec(pattern, url)- returns STRUCT with all match details - Pattern accessors:
urlpattern_pathname(),urlpattern_protocol(),urlpattern_hostname(),urlpattern_port(),urlpattern_search(),urlpattern_hash() - Pattern caching for improved performance on repeated patterns
Quick Start
-- Load the extension
LOAD urlpattern;
-- Test if URLs match a pattern
SELECT urlpattern_test('https://example.com/users/:id', 'https://example.com/users/123');
-- true
-- Extract named groups
SELECT urlpattern_extract('https://example.com/users/:id', 'https://example.com/users/123', 'id');
-- '123'
-- Get full match results
SELECT urlpattern_exec('/posts/:slug', '/posts/hello-world');
-- {matched: true, pathname: '/posts/hello-world', groups: {slug: 'hello-world'}, ...}Supported Platforms
| Platform | Status |
|---|---|
| Linux (amd64) | ✅ |
| Linux (arm64) | ✅ |
| Linux (musl) | ✅ |
| macOS (amd64) | ✅ |
| macOS (arm64) | ✅ |
| Windows | ❌ (MinGW compatibility issue) |
| WASM | ❌ (emscripten compiler issue) |
Installation
Download the appropriate extension for your platform from the release assets, or build from source.
Documentation
See the documentation for full API reference.