Here's a simple regex replace in Textmate for changing lines like:
[[[Thing alloc] initWithWhatever:whoever] autorelease];
to
[[Thing alloc] initWithWhatever:whoever];
The regex is
(\[\[\[)([^\]]*\][^\]]*\])(\ autorelease\]);
and the replacement string is:
[[$2;
Then I needed to fix these lines
for (Thinger *thing in [thingers copy] autorelease])
and I used regex:
(\[)([^\]]*\][^\]]*)(\ autorelease\])
and the replacement string is:
$2
5 comments:
got any more brilliance left in you for retains? And Maybe YOU can tell me why of all things that each and every implementation of regular expressions, are anything but regular? Oh the irony of it all.
got any more brilliance left in you for retains? And Maybe YOU can tell me why of all things that each and every implementation of regular expressions, are anything but regular? Oh the irony of it all.
Um, what? Regular expression implementations are all more similar than different, I think. Are you finding big differences?
Use this one instead:
(\[)(.*){0,100}(\ autorelease\])
and replace with $1$2
then the same, but change "autorelease" for "retain" and "release".
and it will solve all your problems.
Might I suggest modifying the first regex to include additional open brackets.
Like so:
(\[\[\[)([^\[]*[^\]]*\][^\]]*\])(\ autorelease\]);
Post a Comment