regex to take the first, last and middle separated by "-"


I have a huge collection in form:

- -
- - -

I would need to transform these in:

<year> -
<year> - ()

using one regex expression (it is really hard to select the right folders of thoscategories one by one, as they are many).

First, I would have been happy to have - at least - the form:

<year> - -

but I couldn't create a regex to take the first expression before the first "-".

It seems that lazy/non-greedy "?" expression doesn't work.

What is the solution, the right expression for these?

Thank you,

Hi Mike,
do you really use V2.36? I am not quite sure whether my advice is valid for that version, as the current version is 2.49.

Coming to your questions: If you try to rename files then the converter Tag - Filename or Filename - Filename would be suitable. Or an action. Why a regular expression?
You do not have to apply the conversion one by one if you filter your tracks first.
e.g. if you have

- - -
then the filter would be:
%_filename% MATCHES .-.-.-.
With the converter filename - filename and the pattern
%1 - %2 - %3 - %4
and the output pattern
%1\%4 - %3 (%2)
you get it.
But, looking at your output examples, you do not seem to be sure what to do with the "extra" you have to find the right pattern.

BTW: why don't you simply apply the converter Tag - Filename in a brute force action.
If you know what the "extra" is, you could use the square brackets to include optional data:
%artist%\%year% - %album%[ ()]
Or don't you have the data stored in your tags? The I would seriously think about importing that first.


Regarding the version, it must have been set at the first registering.

Not all the files have tags, I have 2 cases I need to handle through one expression (see, " - " is some data, almost never the same, so I can't make a clear pattern) because there are about 128 gigs of mp3s with many albums coming in some of the 2 forms explained.

I've already managed to have one expression to catch the two patterns, but mp3tag says it converts 0 of 2344 cases, although it makes the changes properly. This confused me
What I couldn't do is the replacement when "extra" stuff is missing.
I get "()" in the result, but I could do a proper rename by looking for and removing the "()".

I actually move the files on a pattern like -> <artist\sound\mp3\year - album>.

Mp3Tag is great, although I would prefer a GPL one like puddletag (which claims to be a clone of Mp3Tag) and I plan to move to linux entirely. I do prefer the approach of EasyTag as GUI also.

Thank you.