我使用这个发现了什么 “\\${(.*?)\\}。
所以我尝试了: 新正则表达式(@"\\$\\${(.*?)\\}");
但这似乎不起作用,这里有什么问题?
请您参考如下方法:
我会使用 new Regex(@"\${(.*?)}");
让我们来分析一下:
(@"\\$\\${(.*?)\\}");
^^^^^^ ^^^
|||||| |||-- Your don't need to double your slashes in a literal string.
\ | |
\ | |
\|--------|-- You have 2 "$" and you just want one
|
|-- You don't need to escape "{" since it doesn't enclose digits
and can't be interpreted as a length attribute.
