Tag to filename, replacing invalid characters with user specified ones

Is this possible to set in the :mt_ttf: "Tag to Filename" dialogue, or do I have to write an action to do it?

By default Mp3tag deletes all Windows invalid characters (\ / : * ? " < > |) when doing this.

You can append the mask with the scripting command $validate.
You can specify a replacement character in this command.
You can define a separate validation for each part of the mask.
E.g.: $validate(%artist% - %title%,) validates the whole mask.
$validate(%artist%,-) - $validate(%title%,
defines a hyphen for ARTIST and an uderscore for TITLE.

Thanks, but $validate seems to replace all invalid characters with the same character, not each one with a specific character that I choose.

I've found out that I can use $replace(string,from,to) from the predefined functions in the :mt_ttf: dialogue, which would then do this for example:

$replace(%track%,*,+) would replace all * in the track title with +

also, I can continue adding from,to pairs in the same bracket and it will replace all the characters I choose, like this:

Title tag:
Titoli di Testa: "Canzonetta" / Notturno II [*]

Tag to filename format string:
$num(%track%,2) $replace(%title%,*,+,/,-,:, -,",'') the last thing in the brackets are 2 apostrophes

Resulting filename:
01 Titoli di Testa - 'Canzonetta' - Notturno II [+]

Is this a proper thing to use in Tag - Filename dialogue?

See also ...
Renaming files with tag, replace trailing periods