functional search and replace