Utils: Fix replace with preserve case.

Task-number: QTCREATORBUG-11610
Task-number: QTCREATORBUG-11194

Change-Id: Ia5e70dad0f66ec4d6ee610b59963321ce1fb20ad
Reviewed-by: Christian Stenger <christian.stenger@digia.com>