preg_match删除{$ ...}

Ant*_*ore -4 php regex preg-replace

我正在寻找一个正则表达式preg_replace在大括号之间的字符串中,后跟$符号以这种方式:

{$string} //match
{$123string} //match
{string} //no match
{$string123} //match
[$string] //no match
Run Code Online (Sandbox Code Playgroud)

Mad*_*iha 6

preg_replace('/{\\$(.+)}/', $replacement, $subject);
Run Code Online (Sandbox Code Playgroud)

这是非常基本的RegExp,请阅读.