You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* New feature! Ability to set `endsWith` to match paths like `/test?query=string` and ignore the query string * Remove `isarray` * Explicitly handle trailing delimiters instead of trimming them (e.g. `/test/` is now treated as `/test/` instead of `/test` when matching) * Remove overloaded `keys` argument that accepts `options` * Remove `keys` list attached to the `RegExp` output * Remove asterisk functionality (it's a real pain to properly encode) * Change `tokensToFunction` (e.g. `compile`) to accept an `encode` function for pretty encoding (e.g. pass your own implementation)
**Please note:** The `RegExp` returned by `path-to-regexp` is intended for use with pathnames or hostnames. It can not handle the query strings or fragments of a URL.
44
+
**Please note:** The `RegExp` returned by `path-to-regexp` is intended for ordered data (e.g. pathnames, hostnames). It does not handle arbitrary data (e.g. query strings, URL fragments, JSON, etc).
44
45
45
46
### Parameters
46
47
47
-
The path string can be used to define parameters and populate the keys.
48
+
The path argument is used to define parameters and populate the list of keys.
48
49
49
50
#### Named Parameters
50
51
51
52
Named parameters are defined by prefixing a colon to the parameter name (`:foo`). By default, the parameter will match until the following path segment.
All parameters can be provided a custom regexp, which overrides the default (`[^\/]+`).
121
124
122
125
```js
123
-
var re =pathToRegexp('/:foo(\\d+)', keys)
126
+
var re =pathToRegexp('/:foo(\\d+)')
124
127
// keys = [{ name: 'foo', ... }]
125
128
126
129
re.exec('/123')
@@ -137,7 +140,7 @@ re.exec('/abc')
137
140
It is possible to write an unnamed parameter that only consists of a matching group. It works the same as a named parameter, except it will be numerically indexed.
0 commit comments