Regular Expression Sought to Change Name Pattern of Multi-Disc Albums

Hello Everyone,

I need a regular expression, please, with which to modify the naming convention of multi-disc albums, which are named according to the following pattern:

Album Name (CD 1^6)
Album Name (CD 2^6)
Album Name (CD 3^6)

To this pattern:

Album Name . CD1
Album Name . CD2
Album Name . CD3

Thank you for your consideration.

Why not start with simple replace actions?

  1. Step: Replace all Space and Opening Bracket CD with Space and Dot and Space and CD (--> do you really want to change it this way?)
  2. Step: Replace all Space 1^6 Closing Bracket with 1
  3. Step: Replace all Space 2^6 Closing Bracket with 2
    and so on

If you have more different patterns, we could start thinking about regular expressions too.

Thank you, I started out using the Replace-action, but configured it incorrectly. I will now try again, using your proposal.

Yes, I want to do it that way. However, thank you for the heads-up. Do you see anything wrong with it that I am not aware of?

Your naming convention is not wrong at all, maybe slightly unusual? :wink:

I myself would not use a dot in an ALBUM name, not in the tag and not in the file-/foldername (if you plan to later use the ALBUM content for building a file/folderstructure.)
I would write the CD number into the tag DISCNUMBER (for mp3) and not as part of the ALBUM name.

But you can name your files and fill your tags to whatever you like, it's your collection.

If you like, you can show us what you already have tried, maybe we can spot any syntax errors?

1 Like

By the way, every time the total number of discs in a multi-disc album changes, a new set of replace actions needs to be added to take care of the new total?

I applied your Replace-proposal just now. It works just fine, but I made another mistake in setting it up.

Fixed the error I made.

PS. Would regex not take care of the difference in the total number of albums?

Sorry, I'm not sure if I fully understand the situation.
Do you ask, if in a next multidisc set with 7 or 8 discs (the number after the ^ character?) you have to adapt the replace actions?

You could try it with this "replace with regular expression"-action:
This expects that you have the content already in the tag ALBUM

Regular expression:
\(CD (.*)\^\d+\)
Replace matches with:


Search for (CD and Space
Group together whatever follows until the ^ character one (or more) digit(s) and a closing bracket.
Replace matches with
CD and the content of the group

If you really want to see a dot as divider between the existing album name and the CD-part, you could use this replace matches with string:
\. CD$1

1 Like

You could also use the Action "Guess Values" if all of the albums follow this structure.
Action (Quick): Guess Values
Source format: %album%
Guessing pattern: %album% (CD %discnumber%^%totaldiscs%)

I would filter for all of your multi-disc albums first, this will ensure you only apply this action to those files. Something like this may work if you don't use the ^ character elsewhere:
%album% HAS "^"

Thank you very much, LyricsLover, and I do apologise for my brief explanation. I had to cut it short due to local scheduled power blackouts, and cannot use the PC yet.

Just to confirm, there are very numerous multi-disc, pretagged (Mp3tag) albums for which I have previously used the e.g. (CD1^6) naming convention that is described in my original post. The ALBUM fields of those albums are indeed appropriately tagged according to the album name, and the disc number, followed by the total number of discs. In the renaming of these, the pattern has to change, as also described in my first post, using the exact same album name, adding the dot and correct disc number.

I am going to utilise your proposal at the first opportunity to do so.

1 Like

Would this not remove the (CD %discnumber%^%totaldiscs%) part entirely from the ALBUM tag?
Album Name (CD 1^6)
would become
Album Name
On the other side, you would fill the DISCNUMBER and TOTALDISCS with the values
1 and 6 for the above example.

It does, but I agree with you that using this info and . characters in the album field aren’t particularly ideal. However once this info has been moved to those fields, you can always use them to rebuild the album names any way you choose.

Thank you very much to you both, LyricsLover and MotleyG, for your suggestions. I have a lot of catching up to do on operations/actions I have already forgotten how to do, therefore I have to figure it out anew. I guess I was putting too much hope on a quick way out.

Let us know if you need help for a specific Mp3tag problem or action.
A real example from your collection with the current status and the expected status is useful too.

There are plenty of options to work with. Often the most simple are the best way to go. So try not to overcomplicate things.

This can often lead to making bigger problems later on. So just think about how you really want your library to be managed, then go about migrating what you have now to follow that. There is no "perfect" way to do this, except what works for you.

1 Like


You have absolutely nailed it, and saved the day for me with your proposed regular expression. Fortunately, too, I did keep the ALBUM tag content consistent over time, as per example shown in the original post. Therefore, applying the action is a cinch.

Thank you, I am very grateful for it, as I am now putting the finishing touches to my music library.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.