Use an index for searching instead of modifying target string