0

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++?

issue image

jessehouwing
  • 106,458
  • 22
  • 256
  • 341
SivajiRaw
  • 43
  • 4
  • 1
    In the replace with, don't re-use the `(.*)`, but instead use a capturing group: http://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 `\)`. – jessehouwing Mar 20 '17 at 12:02

1 Answers1

1

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);
Community
  • 1
  • 1
jessehouwing
  • 106,458
  • 22
  • 256
  • 341