I’m trying to replace an album title, from Album Title [Some Text]
to Album Title
. In Name files like this
section, I set the album to:
$set(album,$rreplace(%album%,[\\[\(.*?\)\\]],))
For some reason, this only replaces the square brackets, leaving the Some Text
text in place. Can you please let me know what is the correct format to remove the text and brackets?
Remove the outer square brackets from the expression:
$set(album,$rreplace(%album%,\\[\(.*?\)\\],))
With square brackets in a regular expression you specify a group of characters. Without the escaping needed for tagger script your regular expression read [\[(.?)\]]
. The outer square brackets makes this match the list of characters listed inside, meaning this matches any single character that is literally either [, (, ., ?,) or ].
2 Likes
That works great, thank you @outsidecontext. Philip, I would like to also update automatically the Album
tag with the set value, when files are saved.
Example of tag not being updated:
I tried to set a Tagger script, but is not updating the tag (\s to remove the space before [):
$set(album,$rreplace(%album%,\\s\\[\(.*?\)\\],))
If I run the script, it will correct the Album tag, but my goal is to automatically run that script when I save the files.
1 Like
The script is fine, but tagger scripts are only automatically run in data loaded on the right (release and track information loaded from MusicBrainz).
If you want this applied on files that you don’t match to MusicBrainz data you can run it manually by selecting the files, right click and choosing the script in the context menu under “Run scripts…”
2 Likes