# Variable Filename to Tags

**URL:** <https://community.mp3tag.de/t/variable-filename-to-tags/16507>\
**Category:** Support\
**Created:** [January 14, 2015, 7:23pm UTC](https://community.mp3tag.de/t/variable-filename-to-tags/16507 "2015-01-14T19:23:21Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sera](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/a88e4f/32.png) [@Sera](https://community.mp3tag.de/u/Sera)\
**Post date:** [January 14, 2015, 7:23pm UTC](https://community.mp3tag.de/t/variable-filename-to-tags/16507/1 "2015-01-14T19:23:21Z")

</div>

My filenames have the following pattern:

'artists'[a number of spaces]-[a number of spaces]'title'[a number of spaces]'(album)'

The problem is that the title can also be something like "abc (def)" followed by a number of spaces and then "(album)".

Examples(with.mp3 ending):

Dimitri Vegas & Like Mike, Moguai, Julian Perretta - Body Talk (Mammoth) (Original Mix)  
EDX - Everything (Cazzette Remix)  
EDX- Everything (Cazzette Remix)

The obvious thing to try is Filename-\>Tag. So I tried this, but I did not manage to come up with a way to consider the optional second title thing and the variable number of spaces.

However, I managed to describe the name with a simple Regex:  
(.+?)[]_-[]_(.+?[]_(?:(.+))?)[]_(?:((.\*)))  
$1=artist  
$2=title  
$3=album

Is there a way to edit multiple tags at once with a regex?

---

<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 14, 2015, 7:36pm UTC](https://community.mp3tag.de/t/variable-filename-to-tags/16507/2 "2015-01-14T19:36:48Z")

</div>

As long as the pattern of data an separator stay the same, you are fine  
e.g.  
artist - album  
(space-hyphen-space)  
and  
artist - album  
(space-space-hyphen-space-space)  
it can be split into various fields: use only the single space.  
You end up for the double-space construction with extra spaces at the end of the artist field and a leading space for the album field.  
You may then apply a format-value-action with the $trim() command to get rid of these spaces.

Or you run 2 "replace" action over the filename that first replace every hyphen-space with space-hyphen-space and then all double-spaces with a single space.  
Finally you use a "Guess value" action for \_FILENAME  
with the pattern you would have used in the convert filename-tag-function.

---

<div class="post-metadata">

**Author:** ![Sera](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/a88e4f/32.png) [@Sera](https://community.mp3tag.de/u/Sera)\
**Post date:** [January 14, 2015, 8:57pm UTC](https://community.mp3tag.de/t/variable-filename-to-tags/16507/3 "2015-01-14T20:57:51Z")

</div>

The way I understand your solution, is that it only works for every category when seperated by a sign  
The thing is, it is not always like that.  
It can be 'artist - title (album)'  
or 'artist - title (still title) (album)'  
Brackets are in the filename as written.  
So the 'still title' part is optional and not actually seperated from the album part.

---

<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 15, 2015, 5:59am UTC](https://community.mp3tag.de/t/variable-filename-to-tags/16507/4 "2015-01-15T05:59:40Z")

</div>

> [@Sera](#):
>
> The way I understand your solution, is that it only works for every category when seperated by a sign  
> The thing is, it is not always like that.  
> ..

Yes, you have to adapt your masks to the unique separator for each pattern.  
If it is a different pattern, you have to use a different mask.  
Or you manipulate the original data in such a way that in the end you have a universal pattern - whatever is easier for you.  
Even though the action is called "Guess values" it does not do too much guessing but sticks to the supplied masks.

---

<div class="post-metadata">

**Author:** ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)\
**Post date:** [January 15, 2015, 9:55am UTC](https://community.mp3tag.de/t/variable-filename-to-tags/16507/5 "2015-01-15T09:55:42Z")

</div>

> [@Sera](#):
>
> My filenames have the following pattern: ...  
> The problem is that the title can also be something like "abc (def)" followed by a number of spaces and then "(album)". ... Is there a way to edit multiple tags at once with a regex?

**Your situation is ... $1=artist $2=title $3=album Dimitri Vegas & Like Mike, Moguai, Julian Perretta - Body Talk (Mammoth) (Original Mix) 1------------------------------------------------- 2-------- 3----------------------- EDX - Everything (Cazzette Remix) 1-- 2--------- 3--------------- EDX- Everything (Cazzette Remix) 1-- 2--------- 3--------------- Proposal 1 ... Action Group Action "Format value" Field: ARTIST Formatstring: $regexp(%\_FILENAME%,'^(.+?)\s\*-\s\*(.+?)\s\*(\(.+\))$','$1') Action "Format value" Field: TITLE Formatstring: $regexp(%\_FILENAME%,'^(.+?)\s\*-\s\*(.+?)\s\*(\(.+\))$','$2') Action "Format value" Field: ALBUM Formatstring: $regexp(%\_FILENAME%,'^(.+?)\s\*-\s\*(.+?)\s\*(\(.+\))$','$3') Proposal 2 ... Action "Guess values" Source format: $regexp(%\_FILENAME%,'^(.+?)\s\*-\s\*(.+?)\s\*(\(.+\))$','$1===$2===$3') Guessing Pattern: %ARTIST%===%TITLE%===%ALBUM% To remove round brackets from the tag-field ALBUM, you have to do an additional step.**

DD.20150115.1218.CET

---

<div class="post-metadata">

**Author:** ![Sera](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/a88e4f/32.png) [@Sera](https://community.mp3tag.de/u/Sera)\
**Post date:** [January 16, 2015, 11:19am UTC](https://community.mp3tag.de/t/variable-filename-to-tags/16507/6 "2015-01-16T11:19:38Z")

</div>

Ohrenkino, I see what you mean.  
I decided to go with DetlevD's second proposal as I do not have to rename anything at all.  
Thanks you both for the help, I really appreciate it.

---

<div class="post-metadata">

**Author:** ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)\
**Post date:** [February 9, 2026, 12:25pm UTC](https://community.mp3tag.de/t/variable-filename-to-tags/16507/7 "2026-02-09T12:25:28Z")

</div>

Closed on February 9, 2026, 12:25pm UTC


