diff --git a/ql/lib/codeql/actions/ast/internal/Ast.qll b/ql/lib/codeql/actions/ast/internal/Ast.qll index ffe85b16f93..084474b4020 100644 --- a/ql/lib/codeql/actions/ast/internal/Ast.qll +++ b/ql/lib/codeql/actions/ast/internal/Ast.qll @@ -24,8 +24,9 @@ string getADelimitedExpression(YamlString s, int offset) { // not just the last (greedy match) or first (reluctant match). result = s.getValue() - .regexpFind("\\$\\{\\{\\s*[^\\}]+\\s*\\}\\}", _, offset) - .regexpCapture("(\\$\\{\\{\\s*[^\\}]+\\s*\\}\\})", 1) + .regexpFind("\\$\\{\\{(?:[^}]|}(?!}))*\\}\\}", _, offset) + .regexpCapture("(\\$\\{\\{(?:[^}]|}(?!}))*\\}\\})", 1) + .trim() } private newtype TAstNode =