Visual Studio中的正则替换

现有strings 如下:

/*China*/
/*Japan*/


需要替换为:

string s = "Hello " + "China" + ".Welcome to" + "China"
string s = "Hello " + "Japan" + ".Welcome to" + "Japan"


Ctrl + H打开替换窗口


Find What中填:/\*{[a-zA-Z]+}\*/

Replace With中填:string s = "Hello " + "\1" + ".Welcome to" + "\1"


在Option中选择Use Regular expressions


点击Replace All

你可能感兴趣的:(Visual Studio中的正则替换)