本文介绍了与visual studio中查找/替换的正则表达式相关的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有字符串"[assembly:AssemblyVersion(" x.x.x.x")]"其中x表示0到9之间的值,我想将其替换为"[assembly:AssemblyVersion(TestNameSpace.TestNameClass.strAssemblyVersion)]"。任何人都可以告诉我在视觉工作室的查找/替换对话框中应该使用哪些正则表达式来执行该任务?


I have string "[assembly: AssemblyVersion("x.x.x.x")]" where x represents value from 0 to 9, I want to replace that into "[assembly: AssemblyVersion(TestNameSpace.TestNameClass.strAssemblyVersion)]". Can anyone please tell me what regular expression I should use in find/replace dialog of visual studio to do that task?

最好的问候,
Mushq

Best Regards,
Mushq

推荐答案

This should do it.

string s = Regex.Replace("[assembly: AssemblyVersion("x.x.x.x")]",
"\"[0-9]+.[0-9]+.[0-9]+.[0-9]+\"", "TestNameSpace.TestNameClass.strAssemblyVersion");


这篇关于与visual studio中查找/替换的正则表达式相关的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-15 22:56