If you want to replace some string in Emacs, the primary function to use is replace-string (I think). If the strings, 'old' and 'new' are provided, it will, by default, replace all occurrences, regardless of case, while also preserving case of whatever 'old' was. It's magical yes, but who doesn't like some magic once in a while, especially when it's so convenient... and so sane.

(official description)