Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

chore: remove polynomial regex from MUSTACHE_REGEX (#5328)

Marc Klingenf6de06d695f0
diff --git a/packages/shared/src/utils/stringChecks.ts b/packages/shared/src/utils/stringChecks.ts
index f2e8c94abc..3b8267d3d3 100644
--- a/packages/shared/src/utils/stringChecks.ts
+++ b/packages/shared/src/utils/stringChecks.ts
@@ -8,7 +8,7 @@ export function getIsCharOrUnderscore(value: string): boolean {
export const VARIABLE_REGEX = /^[a-zA-Z][a-zA-Z_]*$/;
// Regex to find variables in mustache syntax
-export const MUSTACHE_REGEX = /{{([^}]*)}}/g;
+export const MUSTACHE_REGEX = /{{([^{}]*)}}+/g;
// Regex to find multiline variables
export const MULTILINE_VARIABLE_REGEX = /{{[^}]*\n[^}]*}}/g;