Dav*_*son 38 regex replace visual-studio-2008
我想替换一些赋值语句,如:
int someNum = txtSomeNum.Text;
int anotherNum = txtAnotherNum.Text;
Run Code Online (Sandbox Code Playgroud)
同
int someNum = Int32.Parse(txtSomeNum.Text);
int anotherNum = Int32.Parse(txtAnotherNum.Text);
Run Code Online (Sandbox Code Playgroud)
使用正则表达式,使用Visual Studio的查找和替换有一个很好的方法吗?我不确定正则表达式是什么.
Mar*_*ins 59
我认为在Visual Studio中,您可以使用花括号标记表达式{txtSomeNum.Text}
.然后在替换中,您可以参考它\1
.所以更换线就像是Int32.Parse(\1)
.
更新:通过@ Timothy003
VS 11取消了{}\1语法并使用()$ 1