Visual Studio 2008 searches and replaces regex

I have a great solution with a lot of strings that I need to replace. In Visual Studio, you can search and replace using regular expressions.

I want to replace lines like:

rst.Fields("CustomerName").Value
rst.Fields("Address").Value
rst.Fields("Invoice").Value

To:

row("CustomerName").ToString()
row("Address").ToString()
row("Invoice").ToString()

Thus, the dynamic text part is preserved, which can change.

Is this possible and how?

Update, solution:
Search: rst.Fields {(. *)}.
Replace Value : rst \ 1.ToString ()

Thanks JaredPar!

+5
source share
3 answers

Try to execute

  • Search Expression: ASpecificCommand(\(.*\))\.ASpecificProperty
  • Replace expression: ATotallyDifferentCommand\1.ATotallyDifferentProperty

. . ( , , , . , .

+3

- .

Visual Studio 2008 (VB.NET):

:

MessageBox.Show("Invalid Entry","Error")

:

MessageBox.Show{(.*,*)}

WIth:

Error.ShowError\1\2

:

Error.ShowError("Invalid Entry","Error")
+2

All Articles