# Removing leading and trailing spaces from content inside brackets

**URL:** https://community.mp3tag.de/t/removing-leading-and-trailing-spaces-from-content-inside-brackets/7214
**Category:** Support
**Created:** [September 18, 2008, 10:10am UTC](https://community.mp3tag.de/t/removing-leading-and-trailing-spaces-from-content-inside-brackets/7214 "2008-09-18T10:10:40Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Harakiri](https://community.mp3tag.de/user_avatar/community.mp3tag.de/harakiri/32/142_2.png) [@Harakiri](https://community.mp3tag.de/u/Harakiri)
#### Post date: [September 18, 2008, 10:10am UTC](https://community.mp3tag.de/t/removing-leading-and-trailing-spaces-from-content-inside-brackets/7214/1 "2008-09-18T10:10:40Z")

</div>

Hello!

**I have several files named in this fashion:**

After the Fire - Der Kommisar ( 12'' Extended remix ).mp3

Arrow - Hot hot hot ( Original extended version ).mp3

Book of Love - I touch roses ( Long stemmed version ).mp3

**I want to remove leading and trailing spaces from content inside brackets in order to rename files like this:**  
   
After the Fire - Der Kommisar (12'' Extended remix).mp3

Arrow - Hot hot hot (Original extended version).mp3

Book of Love - I touch roses (Long stemmed version).mp3

* * *

I know this could be bloody easy to achieve but it's one of those mornings that i just can't figure out how.

Thank you in advance for your attention! 🙂

---

<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: [September 18, 2008, 12:27pm UTC](https://community.mp3tag.de/t/removing-leading-and-trailing-spaces-from-content-inside-brackets/7214/2 "2008-09-18T12:27:39Z")

</div>

> [@Harakiri](#):
>
> ... I want to remove leading and trailing spaces from content inside brackets ...

You may code something like this:  
**$replace('After the Fire - Der Kommisar ( 12'' Extended remix ).mp3','( ','(',' )',')')**

DD.20080918.1627.CEST

---

<div class="post-metadata">

### Author: ![Harakiri](https://community.mp3tag.de/user_avatar/community.mp3tag.de/harakiri/32/142_2.png) [@Harakiri](https://community.mp3tag.de/u/Harakiri)
#### Post date: [September 18, 2008, 12:50pm UTC](https://community.mp3tag.de/t/removing-leading-and-trailing-spaces-from-content-inside-brackets/7214/3 "2008-09-18T12:50:27Z")

</div>

> [@DetlevD](#):
>
> You may code something like this:  
> **$replace('After the Fire - Der Kommisar ( 12'' Extended remix ).mp3','( ','(',' )',')')**
> 
> DD.20080918.1627.CEST

Yes but i had to make that for every single file right?

---

<div class="post-metadata">

### Author: ![Harakiri](https://community.mp3tag.de/user_avatar/community.mp3tag.de/harakiri/32/142_2.png) [@Harakiri](https://community.mp3tag.de/u/Harakiri)
#### Post date: [September 18, 2008, 1:05pm UTC](https://community.mp3tag.de/t/removing-leading-and-trailing-spaces-from-content-inside-brackets/7214/4 "2008-09-18T13:05:36Z")

</div>

> [@Harakiri](#):
>
> Yes but i had to make that for every single file right?

I've sorta figured out and it worked.

I've used the Replace (Filename -\> Filename) in this fashion:

Old filename pattern:

%1 - %2 ( %3 )

New filename pattern:

%1 - %2 (%3)

The boring part was that i had to select all the files by hand in order to satisfy the condiotional.

---

<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:21pm UTC](https://community.mp3tag.de/t/removing-leading-and-trailing-spaces-from-content-inside-brackets/7214/5 "2026-02-09T12:21:06Z")

</div>


