views:

218

answers:

1

I'm trying to replace something like this:

NSSomeFunction(@"some var", @"another one")

With:

NSSomeOhterFunction(@"some var")

In Xcode. So these are source files... I bet the regular expression will look something like this:

NSSomeFunction\((.*), .+\)

But I need this to be lazy. Otherwise .+) will match the last parenthesis occurrence rather than the first (for example both parenthesis in the end would be replaced with a single one given this string: "NSLog(@"%@", NSSomeFunction(@"hey", @"lol"))" ).

How to do lazy search like this? I think you can do this in pearl using the modifier /U (ungreedy). Though Xcode does not seem to support that.

+2  A: 

usually the ? will indicate non-greedy match, so for .+) you would use .+?)

ennuikiller
Thanks, this worked.
quano