How to replace a specific word at the end of FILENAME?

I need to replace _xxx at the end of any audio format with nothing [every _ sign stands in this post for mine for a pause, because this forum will does not allow to show multiple pauses]

So for example

Title Of Song xxx.flac


Title Of Song .flac


Title Of Songxxx.flac

stays as

Title Of Songxxx.flac

[i.e. lack of pause acting a fail-safe]

And also

Title Of Song 2__xx.mp3
Title Of Song 2___XXX.mp3


Title Of Song 2__.mp3
Title Of Song 2___.mp3


Title Of Song 2xx.mp3
Title Of Song 2XXXX.mp3

stay as

Title Of Song 2xx.mp3
Title Of Song 2XXXX.mp3

So how do I do this?

You could try:
$regexp('Title Of Song xxx',(.*)\s+xxx,$1)

I think I should also have precised, that it should work for any titles / filenames, and not just literally for Title Of Song

Modifying this Format Value to

`$regexp(' xxx',(.*)\s+xxx,$1)

makes the whole _FILENAME disappear, leaving only the extension; even when there is no xxx present at all in it

This makes no sense at all if you want to modify the filename - as this look in the string " xxx" for at least 1 space character and "xxx" which produces an empty string in (.*) and therefore deletes the filename.

So, please, instead of the string constant in your examples (and my reply) use the property variable %_filename%.

1 Like

OK, those two variations seem to work as I need it them to do:



So, thank you