# MP3 filename edit

**URL:** https://community.mp3tag.de/t/mp3-filename-edit/17555
**Category:** General Discussion
**Created:** [January 16, 2016, 2:25pm UTC](https://community.mp3tag.de/t/mp3-filename-edit/17555 "2016-01-16T14:25:47Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![boringbob](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/f6c823/32.png) [@boringbob](https://community.mp3tag.de/u/boringbob)
#### Post date: [January 16, 2016, 2:25pm UTC](https://community.mp3tag.de/t/mp3-filename-edit/17555/1 "2016-01-16T14:25:47Z")

</div>

Hello people,

First of all I'd like to thank you for awesome program you developed!

I'm looking for shortcut if is possible. My library is messed up and I'd like to fix it.  
There's bunch of mp3 files who looks like this:

Artist - Live - Year - Album - Tracknumber - Title  
or  
Artist - Year - Track - Title  
or  
Artist - Album - Track - Title

So basically I want to extract Artist and Title, so that is first and last tag.  
Everything in the middle is not needed to me.

Is there a way to do it?  
TIA  
boringbob

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [January 16, 2016, 5:12pm UTC](https://community.mp3tag.de/t/mp3-filename-edit/17555/2 "2016-01-16T17:12:33Z")

</div>

> [@boringbob](#):
>
> ...  
> Is there a way to do it?  
> TIA  
> boringbob

Probably not in one go.  
4-part names can dealt with Converter\>Filename-Tag:  
%artist% - %dummy% - %dummy% - %title%

and 5-part names with  
%artist% - %dummy% - %dummy% - %dummy% - %title%

But why do you throw away already existing information. I would import all of it.  
It is very hard in the end to assign the correct album and track if you only have the artist and title.

---

<div class="post-metadata">

### Author: ![boringbob](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/f6c823/32.png) [@boringbob](https://community.mp3tag.de/u/boringbob)
#### Post date: [January 16, 2016, 6:19pm UTC](https://community.mp3tag.de/t/mp3-filename-edit/17555/3 "2016-01-16T18:19:52Z")

</div>

> [@ohrenkino](#):
>
> Probably not in one go.  
> 4-part names can dealt with Converter\>Filename-Tag:  
> %artist% - %dummy% - %dummy% - %title%
> 
> and 5-part names with  
> %artist% - %dummy% - %dummy% - %dummy% - %title%
> 
> But why do you throw away already existing information. I would import all of it.  
> It is very hard in the end to assign the correct album and track if you only have the artist and title.

Hello, thanks.

The point is I don't really care about other info, I just want Artist and Title.

Isn't there a way to extract it somehow...  
If "-" is a separator, I want something like Filename - Filename, with command:

```
Start from beggining; leave 1st words till "-"
Start from behind, leave last words from "-"

```

Is that possible?  
TIA  
Regards, boringbob.

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [January 16, 2016, 7:47pm UTC](https://community.mp3tag.de/t/mp3-filename-edit/17555/4 "2016-01-16T19:47:24Z")

</div>

if you want to assign the data to fields, you have to use the different patterns.

If you only want to mdofiy the filename, you can use an action of the type "replace with regular expression" for \_FILENAME  
Search string: (._?) - ._ (.\*)  
Replace string: $1 - $2

---

<div class="post-metadata">

### Author: ![boringbob](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/f6c823/32.png) [@boringbob](https://community.mp3tag.de/u/boringbob)
#### Post date: [January 17, 2016, 11:44am UTC](https://community.mp3tag.de/t/mp3-filename-edit/17555/5 "2016-01-17T11:44:03Z")

</div>

Great, this did the trick. Can you please explain me what did you done with that code, what that code means?

TIA boringbob

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [January 17, 2016, 1:45pm UTC](https://community.mp3tag.de/t/mp3-filename-edit/17555/6 "2016-01-17T13:45:27Z")

</div>

> [@boringbob](#):
>
> Great, this did the trick. Can you please explain me what did you done with that code?
> 
> TIA boringbob

As you said:  
(._?) -  
means: take the first bit up to a hyphen in a non-gready way (which is the ?) and save it in a variable.  
._ -  
means: take anything in a gready fashion  
(.\*)$  
means: take anything that is left after the last hyphen as the gready expression before has gobbled everything up and store it in a variable.  
$1 and $2 then refer to that what you find in the 2 blocks in parenthesis.
