Use of re.sub for renaming files/strings not working

Backslashes in file names are rare but not forbidden or impossible under Linux and Mac, so you have to expect that they could exist.

I’ve used a backslash for a file name instead of a forward slash, e.g. I have an image file of the graph of 1/x (a hyperbola) so I called it 1\x.png since I don’t know how to type a Unicode division slash ∕ U+2215 at the keyboard.