Remove track numbers from titles and filenames

[Mods - if the following isn't in the FAQ or how-to's, maybe it should be?]

How to remove numbers in front of titles or filenames:

Select the tracks to be changed (use Edit to "select all" or CTL-A to choose all tracks). Click on Action, seen at the top row . Choose Actions (Quick) from the dropdown actions list. In the new Action Type window, select "replace with regular expression" and click OK.
In the new Replace with regular expression window's Field box enter TITLE (all caps!). In the regular expression box there are three possibilities:

(1) If the track numbers go 01, 02, 03 with no spaces before the numbers, type this expression exactly as it's given - cut &paste is OK:
^[0-9]+\s*
(Meaning: Look from the front of the title for any quantity, including quantity zero, of numbers 0 through 9, and any quantity of spaces after the numbers)

(2) If there are spaces in front of the numbers, like this, 8, 9, 10, type or cut&paste:
^\s*[0-9]+\s*
(Meaning: Look from the front of the title for any quantity of spaces, any quantity of numbers 0 through 9, and any quantity of spaces after the numbers)

(3) If there are dashes ( - ) after the numbers, type:
^\s*\d+\s*-\s*
(Meaning: Look from the front of the title for any quantity of spaces, any quantity of numbers 0 through 9, and any quantity of spaces after the numbers, a - after the spaces, and any quantity of spaces after the dash)

Leave "Replace matches with" empty. Anything typed in here will be added in front of each title.
Do not click the "case-sensitive comparison" box. Numbers don't have upper or lower case, anyway.

Be sure the expression is right, the replace field is empty, the check box is empty, and click OK. If you like the results, save them. If you don't like the results, don't save them. It's that easy.

TITLE can be replaced with _FILENAME to remove numbers, spaces, and dashes in front of filenames. Everything else works as it did for cleaning up titles.

After any these expressions are typed in, they'll be listed in the pull-down with the list of regular expressions. Pull down the list, chose the one you want, and there it is. No typing needed when working on a new set of tracks. The only challenge is remembering the expressions are there, and which one is the right one. Write yourself a note, or do enough work with Mp3tag to remember which expression does what. :wink:

Thus endeth the lesson.


Trying to remove track numbers from titles has been posted to before, but most of the replies follow the form "RTFM but I'll give you a break and a how-to regular expression sample this time. How to use it is your challenge". Rather hostile IMNSHO.

Here is a different approach and no "RTFM" in it:


Actually, there is an example in the HowTos:

Using trim works, of course. But finding and using it becomes its own hunt-for.

Many how-to's have multiple solutions, no question about that. My intent is to describe a procedure which is reasonably simple and effective. Think of it as a tiny "For Dummies" book: Removing Numbers From Titles For Dummies (I strongly dislike the "dummies" part, but "idiots" or "complete idiot" book titles are even worse).

I could have left out the Meaning: comments, but the pedantic in me won't let that happen. LOL

Your examples feature [0-9] for which there is the set \d, so

could be shortened to
^\d+\s
which is 3 characters shorter.
Then if this is to become

I would alter the title of this thread. Your examples do not "Remove track numbers from titles and filenames" but remove only "leading numbers from titles and filenames". As there is no restriction to the length of the number, it could just as well be a number that represents the episode or the year or some id or whatever numeric prefix there is ...
although ... the examples do not remove any number but just the leading ones. So it may be worthwhile to help others to find your instruction as the best help with a title that is as exact as possible.
I hope that

you will see what I mean.

2 Likes

And I thought I was pedantic...

Regexp's can always be shortened and done in any number of ways. The point here is only to get the job done.

"Remove leading numbers"... well, of course. In the context of Mp3tag it's safe to assume that the majority of leading numbers are track or sequence numbers. Given the whole discussion is for those who don't know how to use regular expressions and/or just want to get on with losing those numbers, this is an effective "magic spell" titled to help searches come up with making those track or sequence numbers go away.

If that doesn't fit your world, do your write-up to your satisfaction. Past that, let it go.

On this topic, I'm out.