help with regex to remove parts of the title


hi folks I would apreciate a little help.

ok i have a bunch of mp3's whith the title tag like this.

001 - nameofsong - album example 001 - bozo - bozo's greatest hits

I want to get rid of the track# and the album thus my title would be only bozo

I have poked around a bit and found this
and it seems to work good at removing the track number.
But I am at a loss on how to remove everything from the end of the songname forwards.

big ty for your help.


reg exp: ^[^-]\s+-\s+[^-]\s+-\s+[^-]\s+-\s+([^-])\s+-\s+[^-]$
replace with: $1

^ anchors search to beginning of text string.
[^-] finds everything which is NOT a '-'.
\s+ \s finds whitespace and + is a limiter which finds an unlimited amount of whitespaces.
- finds the '-' character.
It carrys on the pattern with 5 [^-] and 4 \s+-\s+ like the pattern you have.
$ anchors search at end of text string.

notice the surrounding brackets ([^-]) on the 4th [^-] in the reg exp.
The function for this it to capture the text string contained inside that. That is why the return is $1.
If you had another capture in the reg exp the value for that would be $2 and so on. BTW captures work from left to right.
Hope this helps.


You are in luck, the TITLE tag-field's content is a 'well formed' string, which can be easily divided into single items, because of the embedded space-hyphen-space character sequence separators.

When using the Regular Expression language, a possible solution looks like this ...
$regexp(%TITLE%,'^(.+?) - (.+?) - (.+?) - (.+?) - (.+?)$','$4')
... will return the fourth item.

$regexp(%TITLE%,'^(.+?) - (.+?) - (.+?) - (.+?) - (.+?)$','$4 - $5')
... will return the fourth and fifth item, separated by a space-hyphen-space character sequence.

As an alternative you can use ...
Action: "Guess values"
Source format: %TITLE%
Guessing pattern: %DUMMY% - %DUMMY% - %DUMMY% - %TITLE% - %DUMMY%
... will save the fourth item into the tag-field TITLE.

Guessing pattern: %DUMMY% - %DUMMY% - %DUMMY% - %TITLE%
... will save the fourth and fifth item into the tag-field TITLE.

Guessing pattern: %DUMMY% - %TITLE% - %DUMMY%
... will save the second item into the tag-field TITLE.