How can I insert a dash in a specific place?


I have hundreds of mp3s where the title and filename begin with a 5-digit number.

How can I insert a dash and space in the seventh position from the left?

For example:
00001 Chapter 1
00001 - Chapter 1

I know I could replace "Chapter" with"- Chapter", but that won't work because the text after the serial numbers are all different (they don't all say "Chapter")

Is there an action I can write to insert a charcter in an exact spot, a certain number of places from the left or right side?

I haven't created an action yet (just used the quick actions), so a detailed explanation would be greatly appeciated. :slight_smile:


Create an action: Press Alt-5, Press the "New" button in that dialog, enter a meaningful name for the action e.g. "Insert hyphen after number".
(this was the general how-to for actions, now comes the more specific part)
Create an action of the type "Replace with regular expression.
As field select _Filename
as regular expression enter:
^(\d+ )
as replace pattern enter:
$1 -
(please note that there is a blank after the hyphen!)

Store the action by pressing a sequence of OK buttons.
Select a file for test-conversion, select the action from the toolbar-dropdown-action-list.
If the result is satisfactory let MP3tag do the work for you. :wink:

Beside some other ways you can go the way using action "Format value" and Mp3tag Scripting Language.

Field: TITLE
Formatstring: $left(%TITLE%,6)'- '$right(%TITLE%,$sub($len(%TITLE%),6))

00001 Chapter 1
00001 - Chapter 1

How to operate and use Mp3tag, that is your thing to find out.


Thanks ohrenkino and DetlevD

Both ways given worked

Ohrenkino's way worked (i think) because it followed a number
DetlevD's format string worked like a charm (wether it follows a number or not)

I'm trying to learn the scripting, but for someone completely new to it, it's a little hard to learn from the help file.

Thanks again