> For the complete documentation index, see [llms.txt](https://router5.js.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://router5.js.org/guides/path-syntax.md).

# Path Syntax

{% hint style="info" %}
*router5* uses [path-parser](https://github.com/troch/path-parser) for parsing, matching and generating URLs
{% endhint %}

## Defining parameters

Four parameter types are supported:

* `:param`: url parameters
* `;matrix`: matrix parameters
* `*splat`: for parameters spanning over multiple segments. Splat parameters are greedy and could swallow a

  large part of your URL. It is recommended to handle with care and to ONLY use on routes without children.
* `?param1&param2` or `?:param1&:param2`: query parameters

## Constrained parameters

Url and matrix parameters can be constrained with a regular expression. Backslashes need to be escaped.

* `:param<\\d+>` will match numbers only for parameter param
* `;id<[a-fA-F0-9]{8}>` will match 8 characters hexadecimal strings for parameter id

Constraints are also applied when building paths: when passing incorrect params to `.navigate()`, an error will be thrown.

## Absolute nested paths

You can define absolute nested paths (not concatenated with their parent's paths). Note that absolute paths are not allowed if any parent of a node has parameters.

```javascript
const router = createRouter([
    { name: 'admin', path: '/admin' },
    { name: 'admin.users', path: '~/users' }
]);

router.buildPath('admin.users'); // '/users'
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://router5.js.org/guides/path-syntax.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
