繁体   English   中英

寻找“$ {sometext}”的正则表达式

[英]Looking for an regular expression for “${sometext}”

我发现使用这个"\\\\${(.*?)\\\\}

所以我尝试了: new Regex(@"\\\\$\\\\${(.*?)\\\\}");

但这似乎不起作用,这里的问题是什么?

我会使用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.

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM