# Removing text

**URL:** https://community.mp3tag.de/t/removing-text/12491
**Category:** Support
**Created:** [September 8, 2011, 3:56am UTC](https://community.mp3tag.de/t/removing-text/12491 "2011-09-08T03:56:17Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![raybharrell](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/839c29/32.png) [@raybharrell](https://community.mp3tag.de/u/raybharrell)
#### Post date: [September 8, 2011, 3:56am UTC](https://community.mp3tag.de/t/removing-text/12491/1 "2011-09-08T03:56:17Z")

</div>

I want to remove a part of the file name per the below example:

file name is "anita baker - rapture.mp3" or "john legend - ordinary people.mp3"

I want a script to remove everything up to and including the "-" in all file names so all the file names just have a space before the artist name (inserting track number with another macro).

I can't find out to do this because there are no certain number of characters. I could do replace for each artist, but I have to type in each artist's name. Is there an easier way?

Please email response to "raybharrell@gmail.com"

---

<div class="post-metadata">

### Author: ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)
#### Post date: [September 8, 2011, 4:31am UTC](https://community.mp3tag.de/t/removing-text/12491/2 "2011-09-08T04:31:04Z")

</div>

> [@RayH](#):
>
> Please email response to "[raybharrell@gmail.com](mailto:raybharrell@gmail.com)"

I don't think you should put this in any future posts. This is a forum after all and other people may need this info.

**To change**   
anita baker - rapture.mp3  
**To**  
rapture.mp3

_Action type:_ **Replace with regular expression**  
_Field:_ **\_FILENAME**  
_Regular expression:_ **^(.+-\s)(.+)**  
_Replace matches with:_ **$2**

[] case-sensitive comparison

**How it works**  
I've attached a screen shot of the regexp. On the top half you'll see " **^**" which anchors it to the very start of the text and "**()**" with stuff inbetween those. Basically they capture whatevers inside them. So the return is **$2** which in-cases what you need. But for example you COULD say **$1** which would return "_anita baker -_ " instead of "_rapture.mp3_"

 ![](https://community.mp3tag.de/uploads/default/original/2X/e/eccddc4389f1aad2d208c759368eb07e14c9669e.jpg)

---

<div class="post-metadata">

### Author: ![JJ\_Johnson](https://community.mp3tag.de/user_avatar/community.mp3tag.de/jj_johnson/32/67_2.png) [@JJ\_Johnson](https://community.mp3tag.de/u/JJ_Johnson)
#### Post date: [September 8, 2011, 6:31pm UTC](https://community.mp3tag.de/t/removing-text/12491/3 "2011-09-08T18:31:22Z")

</div>

> [@RayH](#):
>
> I want to remove a part of the file name per the below example:
> 
> file name is "anita baker - rapture.mp3" or "john legend - ordinary people.mp3"
> 
> I want a script to remove everything up to and including the "-" in all file names so all the file names just have a space before the artist name (inserting track number with another macro).

I take it the second part is the song title? If you already have the title in the TITLE field, then all you need to do is rename the file using that field.

_Action type:_ **Format value**  
_Field:_ **\_FILENAME**  
_Format string:_ **%title%**

To include the track number, use

_Action type:_ **Format value**  
_Field:_ **\_FILENAME**  
_Format string:_ **$num(%track%,2) %title%**

---

<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 9, 2011, 4:15am UTC](https://community.mp3tag.de/t/removing-text/12491/4 "2011-09-09T04:15:52Z")

</div>

> [@RayH](#):
>
> I want to remove a part of the file name per the below example:  
> file name is "anita baker - rapture.mp3" or "john legend - ordinary people.mp3"  
> I want a script to remove everything up to and including the "-" in all file names so all the file names just have a space before the artist name (inserting track number with another macro).  
> I can't find out to do this because there are no certain number of characters. I could do replace for each artist, but I have to type in each artist's name. Is there an easier way? ...

1. 

Be aware of, that a file name, which starts with a space character, might be not allowed by the underlying filesystem.  
For example, Windows Explorer automatically removes leading space characters from the filename, when trying to rename a file to get leading space characters.

1. 

Action: Format value  
Field: \_FILENAME  
Formatstring: **%TRACK% $right(%\_filename%,$strstr($reverse(%\_filename%),'- '))**

From:  
TRACK = 1  
FILENAME = john legend - ordinary people  
To:  
FILENAME = 1 - ordinary people

... or ...

Action: Format value  
Field: \_FILENAME  
Formatstring: **%TRACK%$right(%\_filename%,$strstr($reverse(%\_filename%),' - '))**

From:  
TRACK = 1  
FILENAME = john legend - ordinary people  
To:  
FILENAME = 1 ordinary people

DD.20110909.0817.CEST  
Edit.20120621.1705.CEST

---

<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:23pm UTC](https://community.mp3tag.de/t/removing-text/12491/5 "2026-02-09T12:23:20Z")

</div>


