From 583c9f8851c24313161e5f194cdab0984e190a71 Mon Sep 17 00:00:00 2001 From: MaxRobinsonTheGreat Date: Sat, 26 Oct 2024 17:14:34 -0500 Subject: [PATCH] fixed regex catastrophic backtracking for nested parens --- src/agent/commands/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/agent/commands/index.js b/src/agent/commands/index.js index 622808e..13d7201 100644 --- a/src/agent/commands/index.js +++ b/src/agent/commands/index.js @@ -14,7 +14,7 @@ export function getCommand(name) { return commandMap[name]; } -const commandRegex = /!(\w+)(?:\(((?:[^)(]+|'[^']*'|"[^"]*")*)\))?/ +const commandRegex = /!(\w+)(?:\(([\s\S]*)\))?/ const argRegex = /(?:"[^"]*"|'[^']*'|[^,])+/g; export function containsCommand(message) {