Reputation: 43
I am using Visual Studio 2013 and I am trying to find and replace a method call using the syntax below:
Find what:
TakeAndCompareScreenshot(.*);
Replace with :
TakeAndCompareScreenshot(.*); \n
Upgrade_CommonMethods.Errorfinder(driver);**
please help me to resolve this problem?
I need to just add Upgrad_CommonMethods.Errorfinder(driver);
in below of all TakeAndCompareScreenshot(.*);
line without any values changes
Is this possible? Either in Visual Studio 2013 or Notepad++?
Upvotes: 0
Views: 253
Reputation: 114461
In the replace with, don't re-use the (.*)
, but instead use a capturing group: https://stackoverflow.com/a/17194010/736079. Also note that (
and )
are special characters in regex and need to be escaped in your search pattern using \(
and \)
.
Search:
TakeAndCompareScreenshot\((.*)\);
Replace ($0
contains the whole string captured by the search):
$0\n Upgrade_CommonMethods.Errorfinder(driver);
Or ($1
contains the contents of the first item between (..)
):
TakeAndCompareScreenshot($1);\n Upgrade_CommonMethods.Errorfinder(driver);
Upvotes: 1