I have a large number of files that need to get a certain function call removed entirely. The first thing that I did was use find-dired to generate a dired list of files from find's output:
find . \( -type f -exec egrep -q -i -e "awesomeMethod\(\s*true\s*\)" \{\} \; \) -ls
Now I have a lot of files. So I hit t to toggle all of them and they become highlighted. Then I hit Q, which brings up query-replace-regex for all marked files. I don't know what the variable is called in each file that I'm getting rid of this call for, e.g., it could be removing $a->awesomeMethod(true); or $betterVariableName->awesomeMethod(true);, so I need a real regex. I was thinking \S+\->awesomeMethod\(\s*?true\s*?\) or something, and replacing it with nothing. I know that's definitely not perfect -- it's a context free grammar :-P -- but it will get me close.
I was surprised when this regex didn't match anything, since it's almost the same as the regex that generated my list of files. Then I saw that even awesomeMethod\(true\) didn't match anything, when I was looking right at something it should match. Thinking that maybe I would have to double-escape the parenthesis because of lisp (even though I'm doing this interactively), I tried awesomeMethod\\(true\\) which again didn't match. Then, surprisingly, awesomeMethod(true) did match, when that is obviously not supposed to in a regex since (...) denotes a capture group. M-S-% on a single file gives the same result.
What am I doing wrong? Emacs 24.3.