#  Replacing in Title tags 

**URL:** https://community.mp3tag.de/t/replacing-in-title-tags/14120
**Category:** Support
**Created:** [November 12, 2012, 10:53pm UTC](https://community.mp3tag.de/t/replacing-in-title-tags/14120 "2012-11-12T22:53:26Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![mpacker](https://community.mp3tag.de/user_avatar/community.mp3tag.de/mpacker/32/406_2.png) [@mpacker](https://community.mp3tag.de/u/mpacker)
#### Post date: [November 12, 2012, 10:53pm UTC](https://community.mp3tag.de/t/replacing-in-title-tags/14120/1 "2012-11-12T22:53:26Z")

</div>

Hi I'd like to learn how to Replace the variable length of my Title tags

From this:  
Mozart P Con #6 In B Flat, K 238 - 3. Rondeau  
Mozart P Con #7 In F For 2/3 Pianos, K 242, "Lodron" - 1. Allegro  
Mozart P Con #7 In F For 2/3 Pianos, K 242, "Lodron" - 2. Adagio  
Mozart P Con #7 In F For 2/3 Pianos, K 242, "Lodron" - 3. Rondeau  
Mozart P Con #8 In C, K 246, "Lützow" - 1. Allegro Aperto

To This:  
Mozart P Con #6 - 3  
Mozart P Con #7 - 1  
Mozart P Con #7 - 2  
Mozart P Con #7 - 3  
Mozart P Con #8 - 1

I imagine this is an action but if it is multiple Tag-tag that would be great - maybe even more clear? Thanks

---

<div class="post-metadata">

### Author: ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)
#### Post date: [November 14, 2012, 1:04am UTC](https://community.mp3tag.de/t/replacing-in-title-tags/14120/2 "2012-11-14T01:04:03Z")

</div>

Using an action like below will do your task by using tag-tag ![:mt_ttt:](https://community.mp3tag.de/uploads/default/original/1X/f8c08645074b054ac98070f71500627b98311bd2.png ":mt\_ttt:") either.

Begin Action Group **\_Script Test#TEST**

**Action #1** _Actiontype 5:_ **Format value** _Field \_\_\_\_\_\_:_ **TITLE** _Formatstring:_ **$regexp(%title%,'^(.{13,15}#\d+\s+)[^-]+(-\s+\d+).+','$1$2')**

End Action Group **\_Script Test#TEST** (1 Action)

Of example file _Mozart P Con #6 In B Flat, K 238 - 3. Rondeau_ the only variable is between the _#6_ and _3_ and at the end where there is the same problem. This is dealt with **[^-]+** which finds anything but a - any number of times after _#6_ and **.+** which takes care of that problem at the end after _3._

Please have a look at the screen-shot of how the regexp works.

 ![](https://community.mp3tag.de/uploads/default/original/2X/3/33a58838f36ad79bc6ed95a192323a55cfe4db69.jpg)  

Any Q. just ask.

 ![](https://community.mp3tag.de/uploads/default/original/2X/3/33a58838f36ad79bc6ed95a192323a55cfe4db69.jpg)

---

<div class="post-metadata">

### Author: ![JJ\_Johnson](https://community.mp3tag.de/user_avatar/community.mp3tag.de/jj_johnson/32/67_2.png) [@JJ\_Johnson](https://community.mp3tag.de/u/JJ_Johnson)
#### Post date: [November 14, 2012, 3:14am UTC](https://community.mp3tag.de/t/replacing-in-title-tags/14120/3 "2012-11-14T03:14:52Z")

</div>

> [@stevehero](#):
>
> **$regexp(%title%,'^(.{13,15}#\d+\s+)[^-]+(-\s+\d+).+','$1$2')**

I wouldn't expect this character count to work well, except in the very narrow context of the example strings. It shouldn't be necessary if you always have '#\d+', or even just '\d+'.

---

<div class="post-metadata">

### Author: ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)
#### Post date: [November 14, 2012, 3:59am UTC](https://community.mp3tag.de/t/replacing-in-title-tags/14120/4 "2012-11-14T03:59:25Z")

</div>

> [@JJ Johnson](#):
>
> I wouldn't expect this character count to work well, except in the very narrow context of the example strings. It shouldn't be necessary if you always have '#\d+', or even just '\d+'.

If that is the case MichaelZulu. Change the {13,15} to +

---

<div class="post-metadata">

### Author: ![mpacker](https://community.mp3tag.de/user_avatar/community.mp3tag.de/mpacker/32/406_2.png) [@mpacker](https://community.mp3tag.de/u/mpacker)
#### Post date: [November 14, 2012, 6:20am UTC](https://community.mp3tag.de/t/replacing-in-title-tags/14120/5 "2012-11-14T06:20:57Z")

</div>

Thank you Steve and JJ, used the + over {13,15} and worked great. RegexBuddy btw looks good multi text file editor? I have been using TexTreplacer.

Michael

---

<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: [November 14, 2012, 6:27am UTC](https://community.mp3tag.de/t/replacing-in-title-tags/14120/6 "2012-11-14T06:27:54Z")

</div>

> [@MichaelZulu](#):
>
> Hi I'd like to learn how to Replace the variable length of my Title tags ...  
> From this:  
> Mozart P Con #6 In B Flat, K 238 - 3. Rondeau  
> Mozart P Con #7 In F For 2/3 Pianos, K 242, "Lodron" - 1. Allegro  
> Mozart P Con #7 In F For 2/3 Pianos, K 242, "Lodron" - 2. Adagio  
> Mozart P Con #7 In F For 2/3 Pianos, K 242, "Lodron" - 3. Rondeau  
> Mozart P Con #8 In C, K 246, "Lützow" - 1. Allegro Aperto  
> To This:  
> Mozart P Con #6 - 3  
> Mozart P Con #7 - 1  
> Mozart P Con #7 - 2  
> Mozart P Con #7 - 3  
> Mozart P Con #8 - 1  
> I imagine this is an action but if it is multiple Tag-tag that would be great - maybe even more clear? Thanks

Your example strings have varying length and look like as they are following always the same pattern.  
%TMP1% #%TMP2% %DUMMY% - %TMP3%. %DUMMY%  
There are fix points in each string, so you can use an action "Guess values" to split the original title string into parts and save the valueable parts into temporary tag-fields.  
Then assemble the new title string from the temporary tag-fields and put it in a temporary tag-field too.  
If the results are looking good, then overwrite the tag-field TITLE with the newly calculated title value.  
Afterwards remove the temporary helper tag-fields.

Here is an action group which has all steps included.

Begin Action Group **Test\_2012#20121114.MichaelZulu** 

Action #1  
_Actiontype 7:_ **Import tag fields (guess values)**  
_Source format \_\_:_ **%TITLE%**  
_Guessing pattern:_ **%TMP1% #%TMP2% %DUMMY% - %TMP3%. %DUMMY%**

 

Action #2  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TMP4**  
_Formatstring:_ **%TMP1% #%TMP2% - %TMP3%**

 

Action #3  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TITLE**  
_Formatstring:_ **%TMP4%**

 

Action #4  
_Actiontype 9:_ **Remove fields**  
_Fields to remove (semicolon separated):_ **TMP1;TMP2;TMP3;TMP4**

 

End Action Group **Test\_2012#20121114.MichaelZulu** (4 Actions)

 

You can also solve this task using the converter "Tag - Tag" and a regular expression function.

  

**Convert** | **Tag - Tag** | **ALT+5**

 

_Select format string_

 

Field:  
**TITLE**

 

Format string:

 **$regexp(%TITLE%,'^(.+#\d+)\s.+(\s-\s\d+).+$','$1$2')** 

Preview  
"Mozart P Con #6 In B Flat, K 238 - 3. Rondeau" -\>  
"Mozart P Con #6 - 3"

 

"Mozart P Con #7 In F For 2/3 Pianos, K 242, "Lodron" - 1. Allegro" -\>  
"Mozart P Con #7 - 1"

 

"Mozart P Con #7 In F For 2/3 Pianos, K 242, "Lodron" - 2. Adagio" -\>  
"Mozart P Con #7 - 2"

 

"Mozart P Con #7 In F For 2/3 Pianos, K 242, "Lodron" - 3. Rondeau" -\>  
"Mozart P Con #7 - 3"

 

"Mozart P Con #8 In C, K 246, "Lützow" - 1. Allegro Aperto" -\>  
"Mozart P Con #8 - 1"

  

DD.20121114.0840.CET

---

<div class="post-metadata">

### Author: ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)
#### Post date: [November 14, 2012, 11:01am UTC](https://community.mp3tag.de/t/replacing-in-title-tags/14120/7 "2012-11-14T11:01:30Z")

</div>

> [@MichaelZulu](#):
>
> Thank you Steve and JJ, used the + over {13,15} and worked great. RegexBuddy btw looks good multi text file editor? I have been using TexTreplacer.
> 
> Michael

Check this out. [RegexBuddy Demo](http://www.regexbuddy.com/democreate.html)

---

<div class="post-metadata">

### Author: ![mpacker](https://community.mp3tag.de/user_avatar/community.mp3tag.de/mpacker/32/406_2.png) [@mpacker](https://community.mp3tag.de/u/mpacker)
#### Post date: [November 14, 2012, 9:51pm UTC](https://community.mp3tag.de/t/replacing-in-title-tags/14120/8 "2012-11-14T21:51:49Z")

</div>

Your example strings have vayring length and look like as they are following always the same pattern.

%TMP1% #%TMP2% %DUMMY% - %TMP3%. %DUMMY%

I wanted to see that thanks

---

<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:24pm UTC](https://community.mp3tag.de/t/replacing-in-title-tags/14120/9 "2026-02-09T12:24:10Z")

</div>


