# RegEx leaves an extra space

**URL:** https://community.mp3tag.de/t/regex-leaves-an-extra-space/64261
**Category:** Support
**Created:** [March 31, 2024, 11:39pm UTC](https://community.mp3tag.de/t/regex-leaves-an-extra-space/64261 "2024-03-31T23:39:41Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![chayes](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/e0b2c6/32.png) [@chayes](https://community.mp3tag.de/u/chayes)
#### Post date: [March 31, 2024, 11:39pm UTC](https://community.mp3tag.de/t/regex-leaves-an-extra-space/64261/1 "2024-03-31T23:39:41Z")

</div>

I use this Action to remove everything in brackets in my Tags :

```auto
Replace with regular expression
_All
(.*)\(.*\)$
$1

```

It works well but unfortunately it leaves a space at the end of each action. This must be the space before the phrase in brackets.

For example

songtitle (text).mp3

becomes

songtitle .mp3

Can someone suggest an amendment to the RegEx above to remove the space as well as the expression in brackets that follows it?

So that

songtitle (text).mp3

becomes

songtitle.mp3

Grateful for any help. 🙂

---

<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: [April 1, 2024, 6:32am UTC](https://community.mp3tag.de/t/regex-leaves-an-extra-space/64261/2 "2024-04-01T06:32:51Z")

</div>

> [@chayes](#):
>
> ```auto
> _All
> (.*)\(.*\)$
> $1
> 
> ```

Try  
`(.*)\s*\(.*\)`  
To cater for no to many spaces following the brackets.

---

<div class="post-metadata">

### Author: ![chayes](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/e0b2c6/32.png) [@chayes](https://community.mp3tag.de/u/chayes)
#### Post date: [April 1, 2024, 2:18pm UTC](https://community.mp3tag.de/t/regex-leaves-an-extra-space/64261/3 "2024-04-01T14:18:28Z")

</div>

Hi

OK thanks for your help.

Unfortunately the space is still there.

I'm trying this -

```auto
_All
(.*)\s*\(.*\)$
$1

```

but it doesn't remove the space. I also tried without the dollar sign in the RegEx code.

Do I have this correct from what you say?

🙂

---

<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: [April 1, 2024, 2:27pm UTC](https://community.mp3tag.de/t/regex-leaves-an-extra-space/64261/4 "2024-04-01T14:27:29Z")

</div>

Perhaps this is better:  
`(.*?)\s*\(.*\)$`

I would never user \_ALL for such an action. Do you really have under controle that you want to delete everything in brackets?  
e.g. Icehouse - Cross the Border (Steel Love) [Dance Mix]  
Aretha Franklin - Oh My Oh My (I'm a Fool for You Baby);  
Don't Play that Song (You Lied);  
Border Song (Holy Moses)  
Queen - Teo Torriatte (Let Us Cling Together)  
and many more at least in my collection.

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [April 1, 2024, 2:29pm UTC](https://community.mp3tag.de/t/regex-leaves-an-extra-space/64261/5 "2024-04-01T14:29:29Z")

</div>

> [@ohrenkino](#):
>
> I would never user \_ALL for such an action

@chayes  
Please, don't use `_ALL`.  
I'm pretty sure you don't want to remove everything in brackets for example in your UNSYNCEDLYRICS or other tags included in \_ALL.

---

<div class="post-metadata">

### Author: ![chayes](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/e0b2c6/32.png) [@chayes](https://community.mp3tag.de/u/chayes)
#### Post date: [April 1, 2024, 5:20pm UTC](https://community.mp3tag.de/t/regex-leaves-an-extra-space/64261/6 "2024-04-01T17:20:57Z")

</div>

Thanks for your help. 🙂

It doesn't have to be \_ALL. This is just an example. I can change this according to need. It's the RegEx where the issue lies.

I Tried this

```auto
_TITLE
(.*?)\s*\(.*\)$
$1

```

...but still the space is there left at the end of the title. It's very stubborn....!

🙂

---

<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: [April 1, 2024, 5:33pm UTC](https://community.mp3tag.de/t/regex-leaves-an-extra-space/64261/7 "2024-04-01T17:33:04Z")

</div>

The more the example resembles the real thing, the better the suggestions.

For me it works:  
 ![grafik](https://community.mp3tag.de/uploads/default/original/3X/4/c/4c002d0f082a79a2f967420eabf39cf839425cc2.png)

---

<div class="post-metadata">

### Author: ![chayes](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/e0b2c6/32.png) [@chayes](https://community.mp3tag.de/u/chayes)
#### Post date: [April 1, 2024, 6:45pm UTC](https://community.mp3tag.de/t/regex-leaves-an-extra-space/64261/8 "2024-04-01T18:45:40Z")

</div>

Thanks ohrenkino - this is working now. 🙂

I'm grateful for your help.

---

<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: [May 2, 2024, 2:50am UTC](https://community.mp3tag.de/t/regex-leaves-an-extra-space/64261/10 "2024-05-02T02:50:52Z")

</div>

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