In xCode I want to look for my NSLog statements that are not prefaced by a { from the previous line.
So I want to not find:
if (debug) {
NSLog(@"MyDebug");
}
and only find.
x=y+3;
NSLog(@"MyDebug %d",x);
I was thinking something like : (?<!\{\r.*NSLog).*NSLog or (?<!\{)\r.*NSLog(?!\{) though that does not seem to get me anything.
As Jeremy mentioned in the comments, Xcode doesn’t support regexes that match multiple lines. However, according to this message in a thread on xcode-users, you can search for newline characters using non-regex search:
If you know the line above the one you wish to match will always end with
;, you could leverage that in a non-regex search.As for grep, unfortunately it doesn’t really like to match multiple lines. pcregrep may be more useful.