# How to replace the fourth underscore to a dash?

**URL:** https://community.mp3tag.de/t/how-to-replace-the-fourth-underscore-to-a-dash/9672
**Category:** General Discussion
**Created:** [January 9, 2010, 3:01pm UTC](https://community.mp3tag.de/t/how-to-replace-the-fourth-underscore-to-a-dash/9672 "2010-01-09T15:01:25Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![evergreen1](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/e/a9adbd/32.png) [@evergreen1](https://community.mp3tag.de/u/evergreen1)
#### Post date: [January 9, 2010, 3:01pm UTC](https://community.mp3tag.de/t/how-to-replace-the-fourth-underscore-to-a-dash/9672/1 "2010-01-09T15:01:25Z")

</div>

i have a title as ...union\_of\_artistic\_people\_in\_pure\_verse  
i want it to be as ...union\_of\_artistic\_people-in\_pure\_verse  
that is i want to get the fourth underscore to a dash. how can i accomplish that?

---

<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 9, 2010, 6:13pm UTC](https://community.mp3tag.de/t/how-to-replace-the-fourth-underscore-to-a-dash/9672/2 "2010-01-09T18:13:01Z")

</div>

> [@evergreen1](#):
>
> ... want to get the fourth underscore to a dash ...

I hope this looks simple enough to understand ... replace the fourth underline from the left with a hyphen:

```
$regexp(%TITLE%,'^(.+?)_(.+?)_(.+?)_(.+?)_(.+?)$','$1_$2_$3_$4-$5')

```

From:  
union\_of\_artistic\_people\_in\_pure\_verse  
To:  
union\_of\_artistic\_people-in\_pure\_verse

DD.20100109.2011.CET

---

<div class="post-metadata">

### Author: ![evergreen1](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/e/a9adbd/32.png) [@evergreen1](https://community.mp3tag.de/u/evergreen1)
#### Post date: [January 9, 2010, 8:04pm UTC](https://community.mp3tag.de/t/how-to-replace-the-fourth-underscore-to-a-dash/9672/3 "2010-01-09T20:04:57Z")

</div>

> [@DetlevD](#):
>
> I hope this looks simple enough to understand ... replace the fourth underline from the left with a hyphen:
> 
> ```
> $regexp('union_of_artistic_people_in_pure_verse','^(.+?)_(.+?)_(.+?)_(.+?)_(.+?)$','$1_$2_$3_$4-$5')
> 
> ```
> 
> From:  
> union\_of\_artistic\_people\_in\_pure\_verse  
> To:  
> union\_of\_artistic\_people-in\_pure\_verse
> 
> DD.20100109.2011.CET

thanks for the suggestions but sorry, it is not clear. what is to be done? where to look in the actions- replace or actions replace with?  
if it is actions  
mp3tag requires the orginal and replace string. then as you have shown should i put the real title in the original and the in the replace line-the string starting with the carrot sign???

or if it is replace with regular expression i have to give the regular expression.. i tried here with your suggestions part starting with the carrot sign but it doesn't work. i have a series of titles in the format given. i want to change it as shown above that is change the fourth underscore to a dash. suggestions plz.

---

<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 10, 2010, 6:55am UTC](https://community.mp3tag.de/t/how-to-replace-the-fourth-underscore-to-a-dash/9672/4 "2010-01-10T06:55:13Z")

</div>

> [@evergreen1](#):
>
> ... sorry, it is not clear. what is to be done? where to look in the actions- replace or actions replace with? ...

Well I can understand your problems, as I started with Mp3tag years ago I was blind like you. The situation is, I sit here and you sit there behind the computer. I cannot take you at hand and do the all things for you. You have to do some work of your own.

I slightly changed my proposal from above, so you may see what tag field is envolved, this is the TITLE tag field what you want to manipulate. Take care that your input strings fit to the regular expression mask, otherwise you will get irritating results. On the basis of the numerous hints and explanations for all cases here on the board you should be able to adapt my simple proposal to your specific needs. My proposal is based on a "Format value" action to work. You can take over the idea and use the regular expression from my proposal with an action "Replace using regular expression".

If you do not understand how a regular expression will be constructed you are free to use all the "traditional" Mp3tag scripting functions to solve your problem. The caveat is, that sometimes you will get rather long expressions to reach your goal, at the other hand a short regular expesssion can do the same.

Good luck, feel free to try out for yourself, that's the best way to learn for yourself.

DD.20100110.0853.CET

---

<div class="post-metadata">

### Author: ![flaminio](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/f/da6949/32.png) [@flaminio](https://community.mp3tag.de/u/flaminio)
#### Post date: [January 10, 2010, 4:28pm UTC](https://community.mp3tag.de/t/how-to-replace-the-fourth-underscore-to-a-dash/9672/5 "2010-01-10T16:28:16Z")

</div>

This seems like a simple one-off kind of edit -- do you really need a regexp for it? Why not just select all the tracks that need the change and change it manually?

---

<div class="post-metadata">

### Author: ![Tarc](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/9fc348/32.png) [@Tarc](https://community.mp3tag.de/u/Tarc)
#### Post date: [January 10, 2010, 8:58pm UTC](https://community.mp3tag.de/t/how-to-replace-the-fourth-underscore-to-a-dash/9672/6 "2010-01-10T20:58:15Z")

</div>

yeah I doubt he's got so many tracks from "Union of Artistic People".. manually editing a whole album takes like half a minute. Hell, simply copying this given code and make an action etc takes more time than that:D

On the other hand maybe he wants to learn how things work - nice, but then I doubt he read the FAQ..

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [April 26, 2019, 7:13am UTC](https://community.mp3tag.de/t/how-to-replace-the-fourth-underscore-to-a-dash/9672/7 "2019-04-26T07:13:49Z")

</div>

2 posts were split to a new topic: [Remove hyphens in filename](https://community.mp3tag.de/t/remove-hyphens-in-filename/45248)

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [April 26, 2019, 7:14am UTC](https://community.mp3tag.de/t/how-to-replace-the-fourth-underscore-to-a-dash/9672/8 "2019-04-26T07:14:32Z")

</div>


