Finish implementing substring search replacement