From 43aceaade02cbb7ea44e04d520496d2e6edf5c9e Mon Sep 17 00:00:00 2001 From: Lars Reimann Date: Mon, 23 Oct 2023 20:40:22 +0200 Subject: [PATCH] feat: use more restrictive regex to match template expressions --- src/cli/generator.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/cli/generator.ts b/src/cli/generator.ts index adfc80dc5..2d64c035a 100644 --- a/src/cli/generator.ts +++ b/src/cli/generator.ts @@ -476,9 +476,8 @@ const generatePythonCall = function ( if (thisParam) { argumentsMap.set('this', thisParam); } - // Extract each placeholder from annotation: Match only strings that start with '$' - // Use look-ahead to only match up to a '.', ',', ')' or a whitespace - return pythonCall.replace(/\$.+?(?=[\s.,)])/gu, (value) => argumentsMap.get(value.substring(1))!); + + return pythonCall.replace(/\$[_a-zA-Z][_a-zA-Z0-9]*/gu, (value) => argumentsMap.get(value.substring(1))!); }; const getArgumentsMap = function (argumentList: SdsArgument[], frame: GenerationInfoFrame): Map {