this thread is in German but you will see that the problem of getting a number from the end of TITLE into YEAR is very similar to getting a number from the end of ALBUM into DISCNUMBER:
Hello and thanks. I understand that $1 should do the trick. There is some progress, and I have tested the regular expression formula, but I am not getting the intended result.
Album name without quotes: 'Dance Vol. 10 ABC'
format discnumber
$regexp(%album%,(\d+)(?!.*\d),$1)
leads to discnumber as
Dance Vol. 10 ABC
instead of the expected and intended
10
Thank you for your further help in the matter. I also will play around more and report.
Yes, because it does not match the pattern that you described in
That pattern reads: a number followed by any string followed by a number.
But Dance Vol. 10 ABC
is: any string, a number, any string. it does not even have the number at the end.
If a regular expression does not find a match, it returns the source string.
Also, I wonder which results you got when you referenced $1 instead of $2 which is actually the number at the end of the string.
Please note that the linked thread uses $regexp(%title%,.*(\d\d\d\d),$1)
If you do not have 4-digit numbers at the end, then use $regexp(%title%,.*(\d\+),$1)
Still, this does not cater for
which would be $regexp(%title%,.*Vol. (\d\+).*,$1)