How do I replace parentheses and colons in script?

I’m really sorry for this basic question! How would I write a script (for tags, not renaming files) that would, in all tags, exchange all parenthesis to brackets, and all colons to dots (∙)? This is what I thought would work for the parentheses part (apart from not being applied to all tags) but didn’t:

$set(title,$replace(%title%,\(,\\[))
$set(title,$replace(%title%,\),\\]))

With this, I get backslash-square bracket in the tag instead of just the square bracket.

Thanks!

Don’t add backslashes to the replacement:

$set(title,$replace(%title%,\(,[))
$set(title,$replace(%title%,\),]))

In Tagger Script a \\ is a backslash. The backslash in front of the paranthesis is needed, because these are reserved characters that need to be escaped.

3 Likes

Ah, that, of course, works, thanks a lot!!

Also, as a follow-up, what is the best way of appliyng this rule to all tags, and not only to e.g. title as in this example?

There is not really a simple way to do it for all tags, you have to do a $set() for each tag.

Side question: As this looks like a change one does typically for file names, is there a specific reason you want the actual tags changed and not only do the replacements for the file names? Doing it only for the file names is usually easier as you don’t need to list all possible tags.

1 Like

Ok, thanks again!
Well, you’re absolutely correct, this is more for the file names. I use the auto-organize in Mediamonkey to rename and move files, but would like all tags to be optimized/ready when going into Mediamonkey.

1 Like

I see. Since you don’t use Picard but MediaMonkey for the renaming it of course makes sense to do the changes in the tags beforehand.

Thanks again for all the help @outsidecontext! I have a library of 54000 songs now waiting to finally be tagged the way I want it :slight_smile: