In XCode 8, how do you use regex search replace to change the case of a character?
regex, xcode, xcode8
Solution
XCode 8 can't do that for you unfortunately. As you have perl, you can open a terminal, `cd` to your repo and run this:
find . -name *.[EXTENSION] -exec perl -i.bak -pe 's/get([A-Z])/\L$1/' {} \;
This will generate a backup of your files (`.bak` files) and change your getters to the needed format.
Problem
I inherited an Objective C project with a bunch of methods named things like "getMerchantSettings". Of course in Objective C (unlike Java) it is unconventional to use the word "get" in the method name for getters, since it makes them incompatible with auto-synthesized property getters, etc. I can globally search my project to find all such offending method names using a regex pattern like `get([A-Z])`. In SublimeText I can replace all these with `\L$1` and it will change everything like "getMerchantSettings" to just say "merchantSettings"; the \L will make the "M" character into the lower case "m" when it replaces it. However in XCode's version of regex, \L and \l both do not work. What is the regex replacement pattern to use in XCode 8 to make it change the case of whatever it's replacing? Would prefer not to have to use a separate text editor for things like that. Thanks!