@Neculai-I.-Fantanaru said: I already have a very good Python code. But I want regex. The Python code (or other programming language) is the right solution. Regex doesn’t work the way you want it to, and do if you’ve got more than one swap to do per file, regex will not solve your problem.