https
scheme, a host and a path. The grammar is narrow on purpose. Every pasted link in a workspace is
checked against every installed app’s patterns, so a pattern must be cheap to match and must not
claim links that belong to someone else.
Writing a pattern
patterns maps a pattern id of your choice to a pattern string. params is typed from the string:
in this example it is { workspace: string; id: string; slug?: string }, and a typo such as
params.idd is a type error.
Patterns must be string literals. A pattern built at runtime from a variable is rejected with
Reference patterns must be string literals so Reintersect can match them statically.
The grammar
Allowed examples
Rejected examples
TypeScript checks the grammar when you write the pattern, and Reintersect checks it again when you deploy. The type error is the message in the table.
The public suffix check uses the full Public Suffix List, including
shared hosting suffixes such as
vercel.app, github.io and pages.dev. A wildcard must sit under a
domain one organization controls.
Parameters
:namecaptures one path segment as a string.:name?captures the final segment when present; the field is optional inparams.- A final
*captures the rest of the path, including slashes, asparams.rest. - Values stay percent-encoded.
https://example.com/files/Q3%20plangives{ name: "Q3%20plan" }for the patternhttps://example.com/files/:name. Decode withdecodeURIComponentwhen you need the text. - Parameters are untrusted input. Validate their format in
resolve, for example with a Zod schema, before you use them in a request.
Several URL shapes for one kind
When the same object has more than one URL shape, give each shape its own entry inpatterns.
resolve receives the id of the pattern that matched as patternId, and params is narrowed
accordingly:
externalId from both shapes so both links show the same shared object. Pattern ids
are 1 to 64 characters from A-Z, a-z, 0-9, _, . and -.
How matching works
Reintersect matches URLs on its own servers. Browsers, the editor and your app never run the patterns. When a URL matches, Reintersect stores which pattern matched and the extracted parameters, and the SDK routes the call to yourresolve by pattern name. Your runtime doesn’t need URLPattern
support.
When more than one pattern matches a URL, from your app or from different apps, Reintersect picks
the most specific one:
- The pattern with the most literal characters wins.
- On a tie, a pattern without a trailing catch-all (
/*) wins over one with it, sohttps://example.com/:team/:projectbeatshttps://example.com/*. - On a further tie, the pattern with fewer wildcards and parameters wins.
- On a final tie, the member’s own development installs come first, then workspace installs in the order they were installed.
Claimed domains
Every host your patterns use should fall under a domain listed in the app’sdomains option.
reintersect check warns about a pattern whose host isn’t claimed: