@@ -98,21 +98,21 @@ findRoute(router, "GET", "/");
9898
9999rou3 supports [ URLPattern] ( https://developer.mozilla.org/en-US/docs/Web/API/URL_Pattern_API ) -compatible syntax.
100100
101- | Pattern | Example Match | Params |
102- | --- | --- | --- |
103- | ` /path/to/resource ` | ` /path/to/resource ` | ` {} ` |
104- | ` /users/:name ` | ` /users/foo ` | ` { name: "foo" } ` |
105- | ` /path/** ` | ` /path/foo/bar ` | ` {} ` |
106- | ` /path/**:rest ` | ` /path/foo/bar ` | ` { rest: "foo/bar" } ` |
107- | ` /files/*.png ` | ` /files/icon.png ` | ` { "0": "icon" } ` |
108- | ` /files/file-*-*.png ` | ` /files/file-a-b.png ` | ` { "0": "a", "1": "b" } ` |
109- | ` /users/:id(\\d+) ` | ` /users/123 ` | ` { id: "123" } ` |
110- | ` /files/:ext(png\|jpg) ` | ` /files/png ` | ` { ext: "png" } ` |
111- | ` /path/(\\d+) ` | ` /path/123 ` | ` { "0": "123" } ` |
112- | ` /users/:id? ` | ` /users ` or ` /users/123 ` | ` {} ` or ` { id: "123" } ` |
113- | ` /files/:path+ ` | ` /files/a/b/c ` | ` { path: "a/b/c" } ` |
114- | ` /files/:path* ` | ` /files ` or ` /files/a/b ` | ` {} ` or ` { path: "a/b" } ` |
115- | ` /book{s}? ` | ` /book ` or ` /books ` | ` {} ` |
101+ | Pattern | Example Match | Params |
102+ | --------------------------- | ---------------------------------- | ------------------------------------------------- --- |
103+ | ` /path/to/resource ` | ` /path/to/resource ` | ` {} ` |
104+ | ` /users/:name ` | ` /users/foo ` | ` { name: "foo" } ` |
105+ | ` /path/** ` | ` /path/foo/bar ` | ` {} ` |
106+ | ` /path/**:rest ` | ` /path/foo/bar ` | ` { rest: "foo/bar" } ` |
107+ | ` /files/*.png ` | ` /files/icon.png ` | ` { "0": "icon" } ` |
108+ | ` /files/file-*-*.png ` | ` /files/file-a-b.png ` | ` { "0": "a", "1": "b" } ` |
109+ | ` /users/:id(\\d+) ` | ` /users/123 ` | ` { id: "123" } ` |
110+ | ` /files/:ext(png\|jpg) ` | ` /files/png ` | ` { ext: "png" } ` |
111+ | ` /path/(\\d+) ` | ` /path/123 ` | ` { "0": "123" } ` |
112+ | ` /users/:id? ` | ` /users ` or ` /users/123 ` | ` {} ` or ` { id: "123" } ` |
113+ | ` /files/:path+ ` | ` /files/a/b/c ` | ` { path: "a/b/c" } ` |
114+ | ` /files/:path* ` | ` /files ` or ` /files/a/b ` | ` {} ` or ` { path: "a/b" } ` |
115+ | ` /book{s}? ` | ` /book ` or ` /books ` | ` {} ` |
116116| ` /blog/:id(\\d+){-:title}? ` | ` /blog/123 ` or ` /blog/123-my-post ` | ` { id: "123" } ` or ` { id: "123", title: "my-post" } ` |
117117
118118- ** Named params** (` :name ` ) match a single segment.
@@ -129,17 +129,17 @@ rou3 supports [URLPattern](https://developer.mozilla.org/en-US/docs/Web/API/URL_
129129
130130rou3 aims for URLPattern-compatible syntax but has intentional differences due to its radix-tree design:
131131
132- | Feature | URLPattern | rou3 |
133- | --- | --- | --- |
134- | ` * ` (single star) | Greedy catch-all ` (.*) ` across ` / ` | Single-segment unnamed param ` ([^/]*) ` |
135- | ` ** ` (double star) | Literal ` ** ` | Catch-all wildcard (zero or more segments) |
136- | ` (.*) ` in segment | Greedy match across ` / ` | Segment-scoped (does not cross ` / ` ) |
137- | ` {...}+ ` / ` {...}* ` groups | Cross-segment group repetition | Only supported within a single segment (no ` / ` in group body) |
138- | Path normalization (` . ` /` .. ` ) | Resolves ` . ` /` .. ` in input paths | Not done by default (opt-in with ` { normalize: true } ` ) |
139- | Case sensitivity | Can be case-insensitive | Always case-sensitive |
140- | Non-` / ` -prefixed paths | Supported | Paths must start with ` / ` |
141- | Unicode param names | Supports Unicode identifiers | Params use ` \w ` (ASCII word chars only) |
142- | Percent-encoding | Normalizes ` %xx ` sequences | Does not decode percent-encoded input |
132+ | Feature | URLPattern | rou3 |
133+ | ----------------------------- | ---------------------------------- | ---------------------------------------------------------- --- |
134+ | ` * ` (single star) | Greedy catch-all ` (.*) ` across ` / ` | Single-segment unnamed param ` ([^/]*) ` |
135+ | ` ** ` (double star) | Literal ` ** ` | Catch-all wildcard (zero or more segments) |
136+ | ` (.*) ` in segment | Greedy match across ` / ` | Segment-scoped (does not cross ` / ` ) |
137+ | ` {...}+ ` / ` {...}* ` groups | Cross-segment group repetition | Only supported within a single segment (no ` / ` in group body) |
138+ | Path normalization (` . ` /` .. ` ) | Resolves ` . ` /` .. ` in input paths | Not done by default (opt-in with ` { normalize: true } ` ) |
139+ | Case sensitivity | Can be case-insensitive | Always case-sensitive |
140+ | Non-` / ` -prefixed paths | Supported | Paths must start with ` / ` |
141+ | Unicode param names | Supports Unicode identifiers | Params use ` \w ` (ASCII word chars only) |
142+ | Percent-encoding | Normalizes ` %xx ` sequences | Does not decode percent-encoded input |
143143
144144### Path normalization
145145
0 commit comments