Xcode replace old style code to new style

Assume you have

[personData setValue:someProperty forKey:someKey]

and you want to change that to

personData[someKey] = someProperty

…and that for about 100 lines ?

Easy! Just type Find (cmd-f in your Xcode, change it to replace, then click on the magnifying glass and select edit find options, and then regular expression for “matching style”. Then type in

Find: \[(.*) setValue:(.*).*forKey:(.*)\];

Replace: $1[$3] = $2;

The ()-part in the find finds the first text addressed by $1, the second ()-part is addressed later by $2

You gotta love regular expressions!