查找"${sometext}"的正则表达式

本文关键字:quot 正则表达式 查找 sometext | 更新日期: 2023-09-27 18:06:55

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

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

查找"${sometext}"的正则表达式

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