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
An effort has been made to ensure ambiguous paths from previous releases throw an error. This means you might be seeing an error when things worked before.
180
180
181
+
### Missing parameter name
182
+
183
+
Parameter names must be provided after `:` or `*`, for example `/*path`. They can be valid JavaScript identifiers (e.g. `:myName`) or JSON strings (`:"my-name"`).
184
+
181
185
### Unexpected `?` or `+`
182
186
183
187
In past releases, `?`, `*`, and `+` were used to denote optional or repeating parameters. As an alternative, try these:
184
188
185
-
- For optional (`?`), use an empty segment in a group such as `/:file{.:ext}`.
186
-
- For repeating (`+`), only wildcard matching is supported, such as`/*path`.
187
-
- For optional repeating (`*`), use a group and a wildcard parameter such as`/files{/*path}`.
189
+
- For optional (`?`), use braces: `/file{.:ext}`.
190
+
- For one or more (`+`), use a wildcard:`/*path`.
191
+
- For zero or more (`*`), use both:`/files{/*path}`.
188
192
189
193
### Unexpected `(`, `)`, `[`, `]`, etc.
190
194
191
-
Previous versions of Path-to-RegExp used these for RegExp features. This version no longer supports them so they've been reserved to avoid ambiguity. To use these characters literally, escape them with a backslash, e.g. `"\\("`.
192
-
193
-
### Missing parameter name
194
-
195
-
Parameter names must be provided after `:` or `*`, and they must be a valid JavaScript identifier. If you want an parameter name that isn't a JavaScript identifier, such as starting with a number, you can wrap the name in quotes like `:"my-name"`.
195
+
Previous versions of Path-to-RegExp used these for RegExp features. This version no longer supports them so they've been reserved to avoid ambiguity. To match these characters literally, escape them with a backslash, e.g. `"\\("`.
196
196
197
197
### Unterminated quote
198
198
199
-
Parameter names can be wrapped in double quote characters, and this error means you forgot to close the quote character.
199
+
Parameter names can be wrapped in double quote characters, and this error means you forgot to close the quote character. For example, `:"foo`.
200
200
201
201
### Express <= 4.x
202
202
203
203
Path-To-RegExp breaks compatibility with Express <= `4.x` in the following ways:
204
204
205
-
- The wildcard `*` must have a name, matching the behavior of parameters `:`.
205
+
- The wildcard `*` must have a name and matches the behavior of parameters `:`.
206
206
- The optional character `?` is no longer supported, use braces instead: `/:file{.:ext}`.
207
207
- Regexp characters are not supported.
208
208
- Some characters have been reserved to avoid confusion during upgrade (`()[]?+!`).
0 commit comments