From 16a076bd7f2233333f24dc22a9a359be1c550a22 Mon Sep 17 00:00:00 2001 From: Ben Kircher Date: Sun, 8 Feb 2026 11:23:48 +0100 Subject: [PATCH] url: refactor regex into documented branches Break up the big monolithic URL and path regex into named sub-pattern constants and compose the final expression from three commented branches: - URLs with a scheme - absolute or dot-relative paths - bare relative paths This commit only breaks up the regex. It keeps the existing matching behavior unchanged. --- src/config/url.zig | 88 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 82 insertions(+), 6 deletions(-) diff --git a/src/config/url.zig b/src/config/url.zig index 5e78d4716..8102460f1 100644 --- a/src/config/url.zig +++ b/src/config/url.zig @@ -22,12 +22,6 @@ const oni = @import("oniguruma"); /// /// There are many complicated cases where these heuristics break down, but /// handling them well requires a non-regex approach. -pub const regex = - "(?:" ++ url_schemes ++ - \\)(?: - ++ ipv6_url_pattern ++ - \\|[\w\-.~:/?#@!$&*+,;=%]+(?:[\(\[]\w*[\)\]])?)+(?