Help with RegExp

I am new to Regular Expression but just cannot get my expression to do exactly what I want.

I have a list music which lists "artist - Track" but sometimes it will be formatted like

0001 - Mozart - Divertimento in D

I am after a RegEep that will remove all the characters before Mozart


Mozart - Divertimento in D

If the characters are numbers try this:
Replace with regular Expression for the field
Search string: ^\d+ -
(there is a blank behind the -)
Replace with:
(leave that empty)

You were not very specific about your task:

  1. Are you going to replace it using a simple text editor on your text file?
  2. Are you doing it on a set of tracks, using Mp3Tag?

Possible Answers:

  1. If you're doing it on a text editor like Notepad++ or EmEditor, this will do the work:
    FIND...: (.)(Mozart.)
    REPLACE: \2

Group 1: (.) - Will match anything, be it a digit, letter or special character.
Group 2: (Mozart.
) - This will match anything that starts with the word Mozart, and everything else until the end of the line.
\2 - This will tell the RegEx "parser" to ignore the first group, and just keep the second, which is the one you want, right? :slight_smile:

  1. If you're using an action in MP3Tag, then you can do it directly with an Action of Type: Replace with Regular Expression.
    I'm uploading a screenshot of the dialogue box, with the fields filled, so that you can see what I mean.

If you are not so familiar with the RegExp scripting language, then you can apply a simple Mp3tag scripting standard function to get the wanted result ...

$trimLeft('0001 - Mozart - Divertimento in D','0123456789 -') ==> 'Mozart - Divertimento in D'

... apply it against a placeholder of your wish, e. g. %TITLE% or %_FILENAME%.


Many thanks for that tip, DetlevD!
It's great and I didn't know about that. :slight_smile:

Unfortunately, the help web page is misleading:

It states: "The optional second parameter specifies the character to trim."
Since it uses the single form of character, I would never have thought it would also work with a string (group) of characters.

But I've just tried it with the Action type : Format Field, and it does work as you said. :slight_smile:

I think that the help file should be changed, to clearly show that.