I have a huge amount of files which are named like this:
xxa - a variable name which can be any length - xb.txt
- The first 'xxa - ' are numbers with a leading zero if they are below 10. There are 2 spaces with a minus-sign in between. They don't surpass 99. They don't add up and there is no logical order here. For instance, there are several files which begin with '01'.
- The variable name can be any length. Sometimes there are &'s in them. There are only spaces, letters and &'s in them.
- The last - xb is optional. There are a not many (around 100) files which are named like this. The x represents a number without a leading zero. None of them surpasses 9.
I want the files renamed like this:
a variable name which can be any length - xxa - xxb
xxb need to get a leading zero. If there isn't a xxb in the original file name, I want the new file name to have - 01.
Is this possible in one regular expression and how? Thank you very much for the answer if you have any. You are all wonderful