url: sort url schemes by most-used

This commit is contained in:
Erlend Lind Madsen
2024-02-02 02:59:55 +01:00
parent ab8d5e261a
commit a3e2d9d250

View File

@ -23,7 +23,7 @@ const oni = @import("oniguruma");
/// There are many complicated cases where these heuristics break down, but /// There are many complicated cases where these heuristics break down, but
/// handling them well requires a non-regex approach. /// handling them well requires a non-regex approach.
pub const regex = "(?:" ++ url_scheme ++ ")(?:[\\w./+:@%?=&-]+(?:\\(\\w*\\))?)+(?<!\\.)"; pub const regex = "(?:" ++ url_scheme ++ ")(?:[\\w./+:@%?=&-]+(?:\\(\\w*\\))?)+(?<!\\.)";
const url_scheme = "ipfs:|ipns:|magnet:|mailto:|gemini://|gopher://|https?://|news:|file:|git://|ssh:|ftp://|tel://"; const url_scheme = "https?://|mailto:|ftp://|file:|ssh:|git://|ssh://|tel:|magnet:|ipfs://|ipns://|gemini://|gopher://|news:";
test "url regex" { test "url regex" {
const testing = std.testing; const testing = std.testing;