Here, we have a rather simple expression that passes pretty much all chars, bounded from left with {
and $
and bounded from right with }
. It collects almost all chars in between:

RegEx
If this expression wasn't desired, it can be modified or changed in regex101.com. For example, we can restrict it and fail special chars, if we like:
({\$\w+})

RegEx Circuit
jex.im visualizes regular expressions:

Demo
const regex = /({\$\w+})/gm;
const str = `{\$foo}
{\$foo_090_}
{\$foo_@#\$%_5678}
{\$foo_@#\$%_{+[]:}`;
let m;
while ((m = regex.exec(str)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
// The result can be accessed through the `m`-variable.
m.forEach((match, groupIndex) => {
console.log(`Found match, group ${groupIndex}: ${match}`);
});
}
PHP Test
$re = '/({\$\w+})/m';
$str = '{$foo}
{$foo_090_}
{$foo_@#$%_5678}
{$foo_@#$%_{+[]:}';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);