Hi metasse,
that's exactly what i had meant with "one is not enough example"
To give an valid answer i need examples with all possible variations of you file names.
New challenge:
FROM
"videofile1.avi"
"videofile12.avi"
"videofile1.en.srt"
"videofile99.eng.srt"
"videofile1.fr.srt"
"videofile12.fr.srt"
"videofile12.fra.srt"
TO
"videofile.CD1.avi"
"videofile.CD2.avi"
"videofile.CD1.en.srt"
"videofile.CD99.en.srt"
"videofile.CD1.fr.srt"
"videofile.CD12.fr.srt"
"videofile.CD12.fra.srt"
Questions:
* is 'srt' an extension like 'avi' ? (i use Yes as your answer)
* are there any digits in the word 'videofile' before those last one or two ? (i use No as your answer)
I will give you an short lesson so you can see the trick.
Note that there are many ways to get an result, depending what your file name contains, the RegEx engine of the tool and on the habit of the author
See this older threads for an RegEx overview:
=> http://www.bulkrenameutility.co.uk/forum/viewtopic.php?f=3&t=5
=> http://www.bulkrenameutility.co.uk/forum/viewtopic.php?f=3&t=27
* first we match one or more of any char ==> .+ and group this ==> (.+) but don't be greedy ==> (.*?)
* then we search for one digit ==> \d followed by one or no digit ==> \d* and group this too ====> (\d\d*)
* then, for some file names there follows the the end ==> $, but for others there are additional chars like '.en' or '.eng', resp. '.fr' or '.fra'
So i drop this "match the end by $" behaviour to be able to cover all possibilities with one RegEx match:
Match-or-not an dot and two or three chars (for simplify of the RegEx i search for one-or-more chars ) and group this ==> ([\.\w+]*)
So i would use
RegEx(1)
Match: (.+?)(\d\d*)([\.\w+]*)
Repla: \1.CD\2\3
[ ] Include Extension un-checked
Explanation:
(.+?) ==> match one-or-more of any sign, but don't be greedy and match to much,
to not match first of the digits too (maybe (\w+) would be clearer to understand)
(\d\d*) ==> match one digit followed by one-or-no digit
([\.\w+]*) ==> match one dot or one-or-more any chars
---
Thinking some more this third match could be simplified to (.*) too
(.*) ==> match non-or-more of any sign (that's there is an '.en' or like that or not)
Match: (.+?)(\d\d*)(.*)
But each simplifying is an risk to don't really match what you want too.
So just try it (that's anyway the key to mastering RegEx: trial-and-error, reading the rules and test, test, test,...)
---
\1 ==> will hold and give back "videofile"
.CD => will put in just this: '.CD'
\2 ==> will hold and give back the digit(s)
\3 ==> will hold nothing or give back ".en" or ".fra" or like that, without the ".srt"-part

--
Or this will work here too:
RegEx(1)
Match: (.+?)(\d+.*)
Repla: \1.CD\2
[ ] Include Extension un-checked
Explanation:
(.+?) ===> match one-or-more any signs non-greedy
(\d+.*) => match one-or-more digit(s) followed by no-or-more of any signs (that's dot or chars here)
As i said: there are many ways. Depending on your filenames one or all may fail to work.
Try and pick the right one for you. Or come up with an totally other solution
HTH

If yes: please help two others too.
And you could please modify the non-saying Subject of this thread
from "Can't find the right expression..."
to smtg like "Match and move digits" or "Reorder digits and add text" or like that...