# RegEx to remove Square Brackets

**URL:** <https://community.mp3tag.de/t/regex-to-remove-square-brackets/16961>\
**Category:** Support\
**Created:** [June 12, 2015, 11:12pm UTC](https://community.mp3tag.de/t/regex-to-remove-square-brackets/16961 "2015-06-12T23:12:02Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [June 13, 2015, 7:05am UTC](https://community.mp3tag.de/t/regex-to-remove-square-brackets/16961/2 "2015-06-13T07:05:32Z")

</div>

> [@Dego](#):
>
> ... Firstly i have this track  
> **Niney The Observer - Blood And Fire [12 Version].mp3**  
> I would line a regex to remove the Square brackets and everything within them and the one that just removed the brackets. Thanks in advance for any help

**Action "Format value" ... or ... Convert "Tag-Tag" Tag-Field: \_FILENAME Formatstring: $regexp(%\_filename%,'\s\*\[.+\]$',)**

**from:  
Niney The Observer - Blood And Fire [12 Version]  
to:  
Niney The Observer - Blood And Fire**

 **Action "Format value" ... or ... Convert "Tag-Tag" Tag-Field: \_FILENAME Formatstring: $regexp(%\_filename%,'\[(.+)\]','$1') From: Niney The Observer - Blood And Fire [12 Version].mp3 To: Niney The Observer - Blood And Fire 12 Version.mp3**

DD.20150613.1121.CEST

To make sure to see only files having a filename with opening and closing square brackets, then for example set the Mp3tag Filter to ...  
"%\_FILENAME%" HAS "[" AND "%\_FILENAME%" HAS "]"

... or ...

To make sure to see only files having a filename with a square bracket clamp at end of the filename, then for example set the Mp3tag Filter to ...  
"$regexp(%\_filename%,'^.+?[.+?]$',)" IS ""

DD.20150614.1840.CEST

---

_[View the full topic](https://community.mp3tag.de/t/regex-to-remove-square-brackets/16961)._
