def ireplace(string, target, replacement):
    """Case-insensitive replace."""
    index = string.lower().find(target.lower())
    if index >= 0:
        result = string[:index] + replacement + string[index + len(target):]
        return result
    else:
        return string