From fa3e5bdb192f7991cc776665422a408d46a02ecd Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Sun, 14 Jun 2020 21:48:19 +0200 Subject: [PATCH] Support route parameter regex in controller route function --- src/Controller.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Controller.ts b/src/Controller.ts index bed86e3..e5b587e 100644 --- a/src/Controller.ts +++ b/src/Controller.ts @@ -15,7 +15,7 @@ export default abstract class Controller { path = path.replace(/:[a-zA-Z_-]+\??/g, '' + params); } else if (Array.isArray(params)) { let i = 0; - for (const match of path.matchAll(/:[a-zA-Z_-]+\??/g)) { + for (const match of path.matchAll(/:[a-zA-Z_-]+(\(.*\))?\??/g)) { if (match.length > 0) { path = path.replace(match[0], typeof params[i] !== 'undefined' ? params[i] : ''); }