diff --git a/source/nodejs/adaptivecards/src/shared.ts b/source/nodejs/adaptivecards/src/shared.ts index 321133081d..456d188974 100644 --- a/source/nodejs/adaptivecards/src/shared.ts +++ b/source/nodejs/adaptivecards/src/shared.ts @@ -84,9 +84,13 @@ export class StringWithSubstitutions { if (this._original) { for (const input of inputs) { - const matches = new RegExp("\\{{2}(" + input.id + ").value\\}{2}", "gi").exec( - this._original - ); + const escapedId = input.id + ? input.id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + : ""; + const matches = new RegExp( + "\\{{2}(" + escapedId + ").value\\}{2}", + "gi" + ).exec(this._original); if (matches != null && input.id) { referencedInputs[input.id] = input;