Attempt at making use of pattern in file.replace a bit more clear

#8326 - attempt at making use of pattern in file.replace a bit more clear