switch to Apple's official string replacement method
check for empty searches to prevent a crash