Inconsistent RegEx Behavior Replace v. Format Value

title = 416 5 Conspiracy Theories
idea is to change this to 416 05 Conspiracy Theories except where album = Skeptoid

Replace w. Regular Expression: ^(\s?\b[0-9]+?\b\s?[.-]?\s?)(\b[0-9]\b) --> \10\2
Result: 416 05 Conspiracy Theories

Format Value: $if($neql(%album%,Skeptoid),$regexp(%title%,^(\s?\b[0-9]+?\b\s?[.-]?\s?)(\b[0-9]\b),\10\2),%title%)
REGEXP ERROR: Regular expression
Invalid preceding regular expression prior to repetition operator. The error occurred while parsing the regular expression fragment: '^(\s?\b+?>>>HERE>>>\b\s??\s?)'.

...more info than you may need...
i change all single digit identifiers to double digits, e.g., 1-01->01-01, 12 1->12 01 ...
this took me two steps

  1. ^(\s?\b[0-9]\b)\s+$ ->0\1
  2. ^(\s?\b[0-9]+?\b\s?[.-]?\s?)(\b[0-9]\b) ->\10\2

However there are certain albums where the 2nd digit is not part of the identifier: Skeptoid - 416 5 Conspiracy Theories (episode number is 416 and NOT 416 05).

Hence the need for specific album exclusions, i.e., $neql(%album%,Skeptoid)


Perhaps you have too few apostrophes to set the first string.
This expression with some added apostrophes around the first pattern:
produces no errors.

TITLE <== $if($eql(%ALBUM%,'Skeptoid'),%TITLE%,$regexp(%TITLE%,'\b\d\b','0$0'))


There is a collision between the RexExp scripting language and the Mp3tag scripting language.
The Mp3tag scripting language uses the square bracket clamb to declare resp. to define an optional value in relation to the existence of an embedded tag-field placeholder.

Look into the format string ...
... from the point of view from the Mp3tag scripting level, there is the first sqare bracket clamb from the left side ... [0-9] ... this expression will be evaluated to an empty string, ...
therefore the Regexp script becomes invalid ... and throws the correct error.

Note: As mentioned in the Mp3tag manual, be aware of escaping each square bracket, when using it in a RegExp ... or even better ... do escape resp. literalize the entire RegExp script.


Thanks for the prompt reply. I routinely literalize all my filtering operations and should have thought of that for this case too.

Great product, don't know what I'd do without it.