help for the script functions such as $regexp:
https://docs.mp3tag.de/scripting
from that link:
$regexp(x,expr,repl):
replaces the pattern specified by the regular expression expr in the string x by repl. The fourth optional parameter enables ignore case (1) or disables the ignore case setting (0). Please note that you have to escape comma and other special characters in expr.
So basically with the function $regexp(x,expr,repl) you can use the action Relace With Regular Expression within other actions such as Guess Values in our case. The "," in the function seperates what you write into the different fields of the action window.
Function:
$regexp(x,expr,repl)
Action:
Field = x
Regular Expression = expr
Replace Matches With = repl
you also need the knowledge from here to about the Guess Values action:
https://docs.mp3tag.de/actions/guess
$regexp(%_filename%,(\d*) (.) (.),$1xxxxx$2xxxxx$3)
So, x is the string which provides the source of the operation. In out case it is the filename. But it could also be a cobination of different palceholders/fields in other cases.
%_filename% = 03 Jefferson Airplane embryonic_journey
$regexp(%_filename%,(\d*) (.) (.),$1xxxxx$2xxxxx$3)
The expression which should be replaced is given here. In our case, it is the whole filename, seperated in different groups.
You can also make expressions which only match parts of the source, in this cases the rest of the source keeps untouched (see here for a example: Need help with RegExp ).
\d* matches a number which is repeated any number of times
.* matches any character repeated any number of times
the spaces are essential, they are the only fix characters here which indicate the seperation of the different matches above.
the parentheses make no difference in the match of the expression. they are only a reference for $1, $2 and $3 later.
So Mp3Tag checks for a sequence of characters in the source which matches \d* .* .*
$regexp(%_filename%,(\d*) (.) (.),$1xxxxx$2xxxxx$3)
This is the replacement for the expression. $1, $2 and $3 is what is found in the first, second and thrid parenthesis of the match:
$1 = 103
$2 = Jefferson Airplane
$3 = embryonic_journey
xxxxx is a free choosen seqence of characters which has the purpose of a marker between the desired field values $1, $2 and $3. As the space, which was the marker before, also is part of the artist name, I replaced it which with something which is surely not part of the artist or title name. If the would be a tilte which is for example "fxxxxxck" it would not work.
So
$regexp(%_filename%,(\d*) (.) (.),$1xxxxx$2xxxxx$3)
is without palceholders
$regexp(103 Jefferson Airplane embryonic_journey,(103) (Jefferson Airplane) (embryonic_journey),103xxxxxJefferson Airplanexxxxxembryonic_journey)
103xxxxxJefferson Airplanexxxxxembryonic_journey is the output of our $regexp funtion
And this serves as the Sourceformat for out Guess Values action.
The Guess value Formatstring now makes use of the xxxxx as spliter between the desired field names:
Sourceformat written as function: $regexp(%_filename%,(\d*) (.) (.),$1xxxxx$2xxxxx$3)
Sourceformat as output of the function: 103xxxxxJefferson Airplanexxxxxembryonic_journey
Formatstring : %track%xxxxx%artist%xxxxx%title%
Output of the Formatstring = Output of the Guess Value Action: