# Replace last Parenthesis on title?

**URL:** https://community.mp3tag.de/t/replace-last-parenthesis-on-title/66311
**Category:** Support
**Created:** [October 19, 2024, 2:09pm UTC](https://community.mp3tag.de/t/replace-last-parenthesis-on-title/66311 "2024-10-19T14:09:46Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![PiC](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/cdc98d/32.png) [@PiC](https://community.mp3tag.de/u/PiC)
#### Post date: [October 19, 2024, 2:09pm UTC](https://community.mp3tag.de/t/replace-last-parenthesis-on-title/66311/1 "2024-10-19T14:09:46Z")

</div>

Hi !  
I try again and again but without any solution.  
I read a lot of topic but nothing to soluce my problem.

When multiple files contain different expressions it is difficult to create the script.  
I would like to replace the last parenthesis with a "-". Concrete example:

"(I Just) Died In Your Arms (Extended Remix)" TO "(I Just) Died In Your Arms - Extended Remix"  
"I like chopin (Extended)" TO "I like chopin - Extended"  
"(Go) breaking my earth (with you) (Single Mix)" TO "(Go) breaking my earth (with you) - Single Mix"

Is there any way to do this ?  
Thanks !

---

<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: [October 19, 2024, 2:43pm UTC](https://community.mp3tag.de/t/replace-last-parenthesis-on-title/66311/2 "2024-10-19T14:43:16Z")

</div>

You could try and action of the type "Format value" for TITLE:  
`$regexp(%title%,(.+) \((.*)\),$1 - $2)`

Just a note: the hyphen is often part of the title itself so next time you want to deal with the classification it may be easier to have that part in characters that are usually not used in titles. The problem of not being unique occurred in your examples.  
So consider to use e.g. square brackets to enclose "Remix" or "Extended"  
-\> "I like chopin [Extended]"

---

<div class="post-metadata">

### Author: ![PiC](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/cdc98d/32.png) [@PiC](https://community.mp3tag.de/u/PiC)
#### Post date: [October 19, 2024, 3:11pm UTC](https://community.mp3tag.de/t/replace-last-parenthesis-on-title/66311/3 "2024-10-19T15:11:56Z")

</div>

Oh, really thanks ohrenkino.  
It's great !  
Because I have trouble understanding how regexp works.

Exemple : I can't understand how to modify your code to have "... [Extended]"

---

<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: [October 19, 2024, 3:37pm UTC](https://community.mp3tag.de/t/replace-last-parenthesis-on-title/66311/4 "2024-10-19T15:37:40Z")

</div>

> [@PiC](#):
>
> to modify your code to have "... [Extended]"

Try:  
`$regexp(%title%,(.+) \((.*)\),$1 '['$2']')`

---

<div class="post-metadata">

### Author: ![PiC](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/cdc98d/32.png) [@PiC](https://community.mp3tag.de/u/PiC)
#### Post date: [October 19, 2024, 4:06pm UTC](https://community.mp3tag.de/t/replace-last-parenthesis-on-title/66311/5 "2024-10-19T16:06:51Z")

</div>

You rock ! Thanks again.  
I have to learn how to use regexp... (Especialy for MP3Tag ?).

---

<div class="post-metadata">

### Author: ![Casual\_Tea](https://community.mp3tag.de/user_avatar/community.mp3tag.de/casual_tea/32/18886_2.png) [@Casual\_Tea](https://community.mp3tag.de/u/Casual_Tea)
#### Post date: [October 20, 2024, 9:17am UTC](https://community.mp3tag.de/t/replace-last-parenthesis-on-title/66311/6 "2024-10-20T09:17:29Z")

</div>

> [@PiC](#):
>
> I have to learn how to use regexp... (Especialy for MP3Tag ?)

Regex is pretty much universal. What might vary from program to program is what extra characters need to be escaped because they have special meaning within the program.

[This](https://www.youtube.com/watch?v=rhzKDrUiJVk) is a basic regex tutorial that should get you started with the syntax.  
The best way I find to actually get comfortable with regex is to use them.  
[This site](https://regexr.com/) is used in the video and also what I use to test and develop my regexes.  
And [this site](https://regexper.com/) can visualize regexes to help you understand what they do and find common pitfalls like using `.` instead of `\.`.

Example:

```auto
^\[(?:(\d{1,2}):)?(\d{1,3}):(\d{1,2})(?:\.(\d{2,3}))?\] *(?!(?:.*<\d{1,3}:|\[\d{1,3}:))(.*)$

```

On its own, this regex might look daunting, but with a visualization

 ![grafik](https://community.mp3tag.de/uploads/default/original/3X/7/e/7e9011a7fda7540bf35763cff4aacecf52c97c7e.png)  
you might guess that this matches variations of lyrics lines in .lrc files that start with a timestamp, like

```auto
[02:30.300]Home is behind
[02:32]The world ahead

```

Anyways, good luck. Regex is fun.

---

<div class="post-metadata">

### Author: ![PiC](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/cdc98d/32.png) [@PiC](https://community.mp3tag.de/u/PiC)
#### Post date: [October 20, 2024, 12:49pm UTC](https://community.mp3tag.de/t/replace-last-parenthesis-on-title/66311/7 "2024-10-20T12:49:52Z")

</div>

It's nice !  
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: [November 19, 2024, 12:50pm UTC](https://community.mp3tag.de/t/replace-last-parenthesis-on-title/66311/8 "2024-11-19T12:50:51Z")

</div>

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