using System;
using System.IO;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Linq;
public class Test
{
public static void Main()
{
var variablesDictionary = new Dictionary<string, string>();
variablesDictionary.Add("$$@Key", "Value");
var pattern = @"\$\$@[a-zA-Z0-9_]+\b";
var stringVariableMatches = Regex.Replace("$$@Unknown and $$@Key", pattern,
m => variablesDictionary.ContainsKey(m.Value) ? variablesDictionary[m.Value] : m.Value);
Console.WriteLine(stringVariableMatches);
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uSU87CnVzaW5nIFN5c3RlbS5UZXh0LlJlZ3VsYXJFeHByZXNzaW9uczsKdXNpbmcgU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWM7CnVzaW5nIFN5c3RlbS5MaW5xOwpwdWJsaWMgY2xhc3MgVGVzdAp7CglwdWJsaWMgc3RhdGljIHZvaWQgTWFpbigpCgl7CgkJdmFyIHZhcmlhYmxlc0RpY3Rpb25hcnkgPSBuZXcgRGljdGlvbmFyeTxzdHJpbmcsIHN0cmluZz4oKTsKCQl2YXJpYWJsZXNEaWN0aW9uYXJ5LkFkZCgiJCRAS2V5IiwgIlZhbHVlIik7CgkJdmFyIHBhdHRlcm4gPSBAIlwkXCRAW2EtekEtWjAtOV9dK1xiIjsKCQl2YXIgc3RyaW5nVmFyaWFibGVNYXRjaGVzID0gUmVnZXguUmVwbGFjZSgiJCRAVW5rbm93biBhbmQgJCRAS2V5IiwgcGF0dGVybiwgCgkJICAgICAgICBtID0+IHZhcmlhYmxlc0RpY3Rpb25hcnkuQ29udGFpbnNLZXkobS5WYWx1ZSkgPyB2YXJpYWJsZXNEaWN0aW9uYXJ5W20uVmFsdWVdIDogbS5WYWx1ZSk7CgkJQ29uc29sZS5Xcml0ZUxpbmUoc3RyaW5nVmFyaWFibGVNYXRjaGVzKTsKCX0KCQoJCn0KCg==