Multi-pattern string replacement and file renaming