0

I have code in a directory tree, with lots of sub-directories.

The function foo() takes two parameters,. which will generally be different for each call.

I want to add a third, which every caller has a variable in a variable named debug.

I want to recurse the directory tree, find every call to foo(x, y) or foo(a,b) or foo(1,2) and add the debug parameter, so that they become foo(x, y, debug), etc

I want a gratis Windows program that will all me to search a filename with wildcards and recurse through the directory tree, finding each line with foo( and changing each ) to , debug)

Any ideas?

1

Use Notepad++ There you can use the Find in Files function, do a regex search with your replace parameter.

You will fill the root directory path, check the In all sub-folders option, mark the Regular Expression option and fill the parameter as:

Find what: (foo\(.+?,.+?)\)

Replace with: $1, debug\)

  • 1
    Lolx! I meant to delete the question before going to bed last night, as that is exactly the conclusion that I had reached. Good that you answered, though, as others can now search for this. I will leave the question open for a bit, in the unlikely case that someone has a non-regexp solution. When no one has posted one, I will award you the answer. Welcome aboard! – Mawg Jan 15 '17 at 10:22
  • No tool for n00bs, then :-/ I accpet this as the answer, since it does just what I want. Now I have two problems :-) – Mawg Jan 19 '17 at 14:22
  • 1
    Regex heheheheh :) Take a time to learn it then you goes back to only one :) – Jorge Campos Jan 19 '17 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.