Album volume to discnumber action (general method using regexp)

Hello all. Please believe me that this is after a lot of trying.
I have several albums with names with

  • 'Vol.' or 'Vol' or 'Volume' or 'vol.'
  • followed with or without space or spaces,
  • followed with numbers of 1-5 digits (this is what I want to extract and turn into discnumber)
  • sometimes as the last thing, but other times with more alphanumerics after that which are to be ignored.


  • XYZ Volume11
  • XYZ Volume 123
  • XYZ Vol.123
  • XYZ Vol. 9
  • XYZ Vol 88 abc
  • XYZ volume1abc

I have tried several regexp strategies, some of them worked in Sublime text, but none perfectly in mp3tag action.

vol.* (\d+)
look promising but do not give results when used as

I would like to create action
$regexp(%album%,expression,$1), if its the correct way to go about it.

I am looking for the best possible expression above. Any help will be immensely helpful organize my collection. As you can imagine, I am using this to merge volumes as single album.

Thanks a lot and good day.

You could try:

Did you try something like \bVol(?:\.|ume)\w*(\d+) for the expression?

Hello. Thanks a lot. This is one problem I am constantly facing. The regex expression seems great. When I test it in sublime text for example.
But but but... when I
create action
Format Value
Format String: $regexp(%album%,\bVol(?:.|ume)\w*(\d+),$1)

I get the entire album name (entire alphanumeric album name) as discnumber rather than just the intended volume number.

Of course I am not technically very sound and don't know what $1 means here, someone had suggested it elsewhere. I want to cry. Please help.

Hello. Thanks a lot. As of initial testing, this seems to be working. I will report more. This helps a lot.

The dollar sign $ variables refer to terms in round parentheses () from left to right, unless manually excluded, which is what I did with that funky ?: in there.

Iʼm not quite sure why or whether $num() is really required here, but you can alter the expression within of course.

In my expression you end up with a string starting with a number.
This could be
for "XYZ Volume 123"
but also
88 abc
for "XYZ Vol 88 abc"
And to transform that string into a number - which means to cut everything non-numerical - I simply used the $num() function.
But as there are many ways that lead to Rome, one probably could have done it with a nested $regexp() or something similar.

You are only matching for a string of digits with (\d+) anyway. That is why Iʼm confused by $num().

Considering the entire album field content (with start ^ and end $ markers) should work then: $regexp(%album%,^.*\bVol(?:.|ume)\w*(\d+).*$,$1).

This does not work for "XYZ Volume 123" as nothing follows the number.

.*$ matches anything at the end, including nothing.

Before we start a theoretical discussion - this is what the preview in Convert>Tag-Tag shows:



You are right, I screwed up: I mixed up \w (word character) with either \W (its inverse) or \s (whitespace character). My bad.
(For a moment, I was afraid those predefined character classes were not supported in Mp3tag, but they are.)

I tested the following scripts successfully with all example strings in this thread:

  • $regexp(%album%,^.*\bVol(?:\.|ume)\s*(\d+).*$,$1)
  • $regexp(%album%,^.*\bVol(?:\.|ume)\W*(\d+).*$,$1)
1 Like

Hello. Thanks. But this does not work for album names such as
abc vol. 15 live on date 13/12/1990
It gives output of disc number as 1513121990 and some how $cutright applie don top does not work either.
Thanks for any further advice.

Hello. This seems to be working wonderfully, though a bit slow (too much computing going on there). But its amazing. I will test further and report back. Thanks everyone.

Hello there, thanks a lot. I have been using the version
But its failing when (Vol1) is in brackets.
Thanks for the amazing help. Some more improvements in this regard will be highly appreciated, even though 90% of my problem is already solved by you.

Hello there.

This is great, but does not work for situations
(Vol 5)
Vol 5,
Vol 5:

I mean when volume the number to be fetched is immediately followed by ) , :

Any further guidance will go a long way.


I don't know what changed, but this stopped working altogether. It was working yesterday.


If the trailing dot is actually optional, you need to add a question mark in the proper place.


1 Like

I would seriously consider an action group that unifies all these variations to just a single expression.

Hello, good day.
Yes sure. But being very limited on regex I would need further help on how to remove brackets, colons, commas after the end of numbers. Isn't \s \W be replaced with something that can also take care of these. Basically in
when non-digits are encountered after we first encounter them after Volume, we should stop looking.
Please accept my distinguished thanks for all the effort and attention.