简体   繁体   English

Resharper查找替换正则表达式

[英]Resharper Find-Replace Regex

I am attempting to replace my WebInvoke headers with the correct REST header using Resharper's replace tool. 我试图使用Resharper的替换工具将WebInvoke标头替换为正确的REST标头。

For example I currently have the following: 例如,我目前有以下内容:

[WebInvoke(Method = "DELETE", UriTemplate = "{id}")]

and I want to replace it with 我想用替换

    [HttpDelete]
    [Route("{id}")]

When I use the Resharper tool, I have this as my search: 当我使用Resharper工具时,我将其作为搜索内容:

[WebInvoke(Method = "DELETE", UriTemplate = $uri$)]

and this as my replace: 这是我的替换:

[HttpDelete]
[Route("$uri$")]

I have set uri as just an identifier. 我已经将uri设置为一个标识符。 When I run it, it does not replace any of the webinvoke tags to the correct one. 当我运行它时,它不会将任何webinvoke标记替换为正确的标记。

Thank you! 谢谢!

Maybe it makes sense to replace only this part or code 也许仅替换此部分或代码是有意义的

[WebInvoke(Method = "DELETE", UriTemplate = 

with this part of code 这部分代码

[HttpDelete]
[Route(

So you don't need to use $uri$ 因此您不需要使用$ uri $

And actually you could do this replacement without Regexes: 实际上,您可以在没有正则表达式的情况下进行以下替换: 在此处输入图片说明

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

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