# How re-arrange order while inserting tag from field in filename?

**URL:** https://community.mp3tag.de/t/how-re-arrange-order-while-inserting-tag-from-field-in-filename/67985
**Category:** Support
**Created:** [March 27, 2025, 5:12pm UTC](https://community.mp3tag.de/t/how-re-arrange-order-while-inserting-tag-from-field-in-filename/67985 "2025-03-27T17:12:21Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![temboroho](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/f4b2a3/32.png) [@temboroho](https://community.mp3tag.de/u/temboroho)
#### Post date: [March 27, 2025, 5:12pm UTC](https://community.mp3tag.de/t/how-re-arrange-order-while-inserting-tag-from-field-in-filename/67985/1 "2025-03-27T17:12:21Z")

</div>

Hi!

I am trying to change with a batch action the name of my files in a playlist named to insert the Artist before the title name following this pattern and logic.

From:  
02. You & Me (Rivo Extended Mix)  
where 02 is the playlist track number but NOT the track number in the %track% field (in this field it refers to number in the album it pertains originally and would like to keep it that way if possible)

To:  
02. Disclosure - You & Me (Rivo Extended Mix)  
where Disclosure is inserted and populated in the %ARTIST% field without changing the track# or title from the tags

To achieve this, I have created an action Replace With Regular Expression like this:  
Field: \_FILENAME  
Regular expression: (^\d{2}\.) (.+)  
Replace matches with: $1 %ARTIST% - $2

But it doesn't insert the artist in the filename (for example Disclosure), instead I end up with:  
02. %ARTIST% - You & Me (Rivo Extended Mix)

I have also tried to do it with the filename to filename converter like:  
Old filename pattern: %1. %2  
New filename pattern: $num(%1,2). %ARTIST% %2  
But it doesn't work either...

Could you please let me know what I am doing wrong or how to achieve my expected result?

Thanks in advance

---

<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: [March 27, 2025, 5:21pm UTC](https://community.mp3tag.de/t/how-re-arrange-order-while-inserting-tag-from-field-in-filename/67985/2 "2025-03-27T17:21:46Z")

</div>

> [@temboroho](#):
>
> Field: \_FILENAME  
> Regular expression: (^\d{2}.) (.+)  
> Replace matches with: $1 %ARTIST% - $2

I think that this is a good approach but you have to use a function that allows a format string to get the contents of %artist% as string.  
So try either an action of the type "Format value" or Convert\>Tag-Tag for \_FILENAME  
Format string: `$regexp(%_filename%,(^\d{2}\.) (.+),$1 %ARTIST% - $2)`

---

<div class="post-metadata">

### Author: ![temboroho](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/f4b2a3/32.png) [@temboroho](https://community.mp3tag.de/u/temboroho)
#### Post date: [March 27, 2025, 5:53pm UTC](https://community.mp3tag.de/t/how-re-arrange-order-while-inserting-tag-from-field-in-filename/67985/3 "2025-03-27T17:53:30Z")

</div>

It works perfectly. And now I understand what I was doing wrong. Thank you Ohrenkino, much appreciate your help and fast response!

---

<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: [April 26, 2025, 5:53pm UTC](https://community.mp3tag.de/t/how-re-arrange-order-while-inserting-tag-from-field-in-filename/67985/4 "2025-04-26T17:53:42Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
