# A regex queries to delete the first instance of everything in a parenthesis

**URL:** https://community.mp3tag.de/t/a-regex-queries-to-delete-the-first-instance-of-everything-in-a-parenthesis/59233
**Category:** Support
**Created:** [November 29, 2022, 4:48am UTC](https://community.mp3tag.de/t/a-regex-queries-to-delete-the-first-instance-of-everything-in-a-parenthesis/59233 "2022-11-29T04:48:02Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![lordlance](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/51bf81/32.png) [@lordlance](https://community.mp3tag.de/u/lordlance)
#### Post date: [November 29, 2022, 4:48am UTC](https://community.mp3tag.de/t/a-regex-queries-to-delete-the-first-instance-of-everything-in-a-parenthesis/59233/1 "2022-11-29T04:48:02Z")

</div>

I want a simple regex to delete the first instance of everything in a parenthesis, i.e. capture everything after the parenthesis. I wrote a simple code which works: [regex101: build, test, and debug regex](https://regex101.com/r/tqVdvg/1)  
But running it on mp3tag gives strange results:

 ![image](https://community.mp3tag.de/uploads/default/original/2X/8/86c15c6cb62ccbc2e226e0b3ebaf21cd4ebca0dc.png)

![image](https://community.mp3tag.de/uploads/default/original/2X/5/59cf0aedf938427f80d95d0dc897165fb7b4550b.png)

---

<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: [November 29, 2022, 6:33am UTC](https://community.mp3tag.de/t/a-regex-queries-to-delete-the-first-instance-of-everything-in-a-parenthesis/59233/2 "2022-11-29T06:33:44Z")

</div>

Please test your expressions in MP3tag with Convert\>Tag-Tag and the scripting function $regexp()

To replace everything leading in parenthesis, try Convert\>Tag-Tag for TITLE:  
Format string: `$regexp(%title%,^\(.*?\)\s*,)`

In general, to address the captured string part, use $1 instead of \1

... and there are a lot of threads that deal with the removal of parenthesis and their contents, e.g.

> [@Removing Parenthesis in Titles Along with Spaces](https://community.mp3tag.de/t/removing-parenthesis-in-titles-along-with-spaces/58917):
>
> I found this Action: It works but it leaves a space in the title. It's not that big a deal when the parenthesis are at the end, but it's an issue when they're at the beginning. "(I Just) Died in Your Arms" becomes " Died in Your Arms". Can the parenthesis be removed along with the extra space? Edit: Here's what that linked Action is doing so you don't have to download it to see: Regular expression: \(.+\)

---

<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 4, 2024, 7:35am UTC](https://community.mp3tag.de/t/a-regex-queries-to-delete-the-first-instance-of-everything-in-a-parenthesis/59233/3 "2024-11-04T07:35:00Z")

</div>

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