diff --git a/src/index.spec.ts b/src/index.spec.ts index 5dcff78..a4cae6b 100644 --- a/src/index.spec.ts +++ b/src/index.spec.ts @@ -2611,6 +2611,21 @@ const TESTS: Test[] = [ [["foobar", ["foobar", "foobar"]]], [[{ name: "foobar" }, "foobar"]], ], + [ + ":name+", + undefined, + [ + { + name: "name", + prefix: "", + suffix: "", + modifier: "+", + pattern: "[^\\/#\\?]+?", + }, + ], + [["foobar", ["foobar", "foobar"]]], + [[{ name: "foobar" }, "foobar"]], + ], ]; /** diff --git a/src/index.ts b/src/index.ts index 1671366..a419ae6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -563,7 +563,7 @@ export function tokensToRegexp( route += `(?:${prefix}(${token.pattern})${suffix})${token.modifier}`; } } else { - if (token.modifier === "*") { + if (token.modifier === "+" || token.modifier === "*") { route += `((?:${token.pattern})${token.modifier})`; } else { route += `(${token.pattern})${token.modifier}`;