Rather than opening a bunch of solution files in VS2010 and then searching for occurrences / references of a function call, I'd rather just grep with a regular expression. I could do this in two passes -- first grep for all occurrences of MyFunction()
, then remove all occurrences where it is on a line that is commented out (note: I realize this doesn't handle block comments, and that is okay for now).
I wanted to see if there was a better way to do it, and regular-expressions.info has an interesting tutorial on positive and negative lookaheads and lookbehinds.
Using my favorite online regex evaluator, I tackled the following examples:
// foo.MyFunction()
foo.MyFunction();
foo.MyFunction()
//foo.MyFunction()
// { foo.MyFunction(); }
but failed miserably. I'm not even sure if what I'm trying to do is possible with negative lookbehinds. Here's what I thought might work:
(?<!//.*)MyFunction\(\)
But it doesn't match... can anyone enlighten me here?
Did the same thing a few times
Online Regex Tester