# Deleting or Removing Characters at the End of a String

**URL:** https://community.mp3tag.de/t/deleting-or-removing-characters-at-the-end-of-a-string/9717
**Category:** General Discussion
**Created:** [January 17, 2010, 7:08am UTC](https://community.mp3tag.de/t/deleting-or-removing-characters-at-the-end-of-a-string/9717 "2010-01-17T07:08:43Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![lobojon](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/47e85d/32.png) [@lobojon](https://community.mp3tag.de/u/lobojon)
#### Post date: [January 17, 2010, 7:08am UTC](https://community.mp3tag.de/t/deleting-or-removing-characters-at-the-end-of-a-string/9717/1 "2010-01-17T07:08:43Z")

</div>

Hello everyone,

I read through the FAQ and ran several searches in the forum (4 hours of my failure to locate an answer) in an attempt to delete some characters from the end of my title field. As I understand it, the process should work on any field. Anywhoooo

I found in the FAQ deleting leading characters where ^.{4} deleted the first 4 letters from the left. That was great and simple. My next question would be how to include deleting numbers and characters from the left. Since that was so easy, I figured the same issue for trailing characters would be easy to tackle.

So, I tried to understand some principles and arrived at the expression [4\w]$ which only removes one letter or number at a time at the end of my title and does not remove a "."

My problem is that I have a title with ".mp3" included as part of the title. No, it is not the file extension. The entire title therefore looks like this: song of the south.MP3.mp3

I want to remove the last 4 characters in the song title. In this case, the 4 characters happen to be ".mp3". I figured that I could then use the same expression and just change the number if I run into any other weirdness.

If you know where the existing post is that answers this question, please indicate.  
If you can solve this problem, that would be great.  
If you think there is a better way to solve this particular issue, please school me.

Thank you very much for your consideration.

---

<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: [January 17, 2010, 8:07am UTC](https://community.mp3tag.de/t/deleting-or-removing-characters-at-the-end-of-a-string/9717/2 "2010-01-17T08:07:37Z")

</div>

> [@lobojon](#):
>
> My problem is that I have a title with ".mp3" included as part of the title. No, it is not the file extension. The entire title therefore looks like this: song of the south.MP3.mp3
> 
> I want to remove the last 4 characters in the song title.

Why don't you simply search and replace the incriminating string with an action.

Actually, I would always apply a filter first which meets the search criteria to macke sure that the handled files are realy the ones I want to hit. Any kind of global search and replace in databases leads to funny effects. Like the Beatles "White Album" becomes the "White A".  
If you write the action, you can easily edit it to meet other string requirements, even in the middle of a title.

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [January 17, 2010, 9:42am UTC](https://community.mp3tag.de/t/deleting-or-removing-characters-at-the-end-of-a-string/9717/3 "2010-01-17T09:42:50Z")

</div>

Last 4 characters is .{4}$  
. includes numbers

---

<div class="post-metadata">

### Author: ![lobojon](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/47e85d/32.png) [@lobojon](https://community.mp3tag.de/u/lobojon)
#### Post date: [January 17, 2010, 4:05pm UTC](https://community.mp3tag.de/t/deleting-or-removing-characters-at-the-end-of-a-string/9717/4 "2010-01-17T16:05:19Z")

</div>

> [@ohrenkino](#):
>
> Why don't you simply search and replace the incriminating string with an action.
> 
> Actually, I would always apply a filter first which meets the search criteria to macke sure that the handled files are realy the ones I want to hit. Any kind of global search and replace in databases leads to funny effects. Like the Beatles "White Album" becomes the "White A".  
> If you write the action, you can easily edit it to meet other string requirements, even in the middle of a title.

* * *

Various posts mentioned filtering and the search and replace action, but I could not figure out how to get it to work. If you know of the particular post that describes the process, I will gladly check it out.  
Thank you for your suggestion.

---

<div class="post-metadata">

### Author: ![lobojon](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/47e85d/32.png) [@lobojon](https://community.mp3tag.de/u/lobojon)
#### Post date: [January 17, 2010, 4:10pm UTC](https://community.mp3tag.de/t/deleting-or-removing-characters-at-the-end-of-a-string/9717/5 "2010-01-17T16:10:36Z")

</div>

> [@dano](#):
>
> Last 4 characters is .{4}$  
> . includes numbers

* * *

Fantastic! Thank you very much.

I had lost the page that defined the various wild cards. I thought the secret missing ingredient was in the \w, s, d, t or something like that.

---

<div class="post-metadata">

### Author: ![theonlyrick](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/a9a28c/32.png) [@theonlyrick](https://community.mp3tag.de/u/theonlyrick)
#### Post date: [January 24, 2010, 12:14pm UTC](https://community.mp3tag.de/t/deleting-or-removing-characters-at-the-end-of-a-string/9717/6 "2010-01-24T12:14:17Z")

</div>

I know it's not needed now, but here's my 2 cents, which is about 10p in British money... ☹

Carry out a Replace action: Find **.mp3.mp3** replace with **.mp3**

That way you guarantee that the effect will be limited to just the incorrectly named files...

---

<div class="post-metadata">

### Author: ![evergreen1](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/e/a9adbd/32.png) [@evergreen1](https://community.mp3tag.de/u/evergreen1)
#### Post date: [February 1, 2010, 12:37pm UTC](https://community.mp3tag.de/t/deleting-or-removing-characters-at-the-end-of-a-string/9717/7 "2010-02-01T12:37:17Z")

</div>

> [@lobojon](#):
>
> * * *
> 
> Various posts mentioned filtering and the search and replace action, but I could not figure out how to get it to work. If you know of the particular post that describes the process, I will gladly check it out.  
> Thank you for your suggestion.

i also cant understan this. anybody plz explain how to filter with a search?

---

<div class="post-metadata">

### Author: ![PS2801](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/p/f1d935/32.png) [@PS2801](https://community.mp3tag.de/u/PS2801)
#### Post date: [February 1, 2010, 5:04pm UTC](https://community.mp3tag.de/t/deleting-or-removing-characters-at-the-end-of-a-string/9717/8 "2010-02-01T17:04:47Z")

</div>

Hi,

I'll try to exlain it to you.

1. go to the menulist and select "víew -\> filter"
2. type in ".MP3.mp3"
3. Only the files with ".MP3.mp3" in a tag field are displayed.
4. click on a file then press "ctrl + A" to select all files
5. go to the menulist and select "convert -\> actions"
6. click on ![:mt_new:](https://community.mp3tag.de/uploads/default/original/1X/ec5caa1b5d6c43fd0fe30efd3515a713a18c5105.png ":mt\_new:"), type in a name for th new action
7. click on ![:mt_new:](https://community.mp3tag.de/uploads/default/original/1X/ec5caa1b5d6c43fd0fe30efd3515a713a18c5105.png ":mt\_new:"), select "replace"
8. A new window appears, write "TITLE" in the first field
9. type ".MP3.mp3" in the second field
10. click on "OK" the window closes
11. click on "OK" the seccond window closes
12. uncheck all unanted actions and select "your action"
13. click "OK" and wait till mp3tag has done his work
14. now the titles of the files should be ok

I hope that this little tutourial is deatailed enough. 😉

Greetings

---

<div class="post-metadata">

### Author: ![lobojon](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/47e85d/32.png) [@lobojon](https://community.mp3tag.de/u/lobojon)
#### Post date: [February 5, 2010, 1:05am UTC](https://community.mp3tag.de/t/deleting-or-removing-characters-at-the-end-of-a-string/9717/9 "2010-02-05T01:05:11Z")

</div>

> [@PS2801](#):
>
> I hope that this little tutourial is deatailed enough. 😉

Thank you very much. I will give your filter tutorial a try.

---

<div class="post-metadata">

### Author: ![vvcepheus7](https://community.mp3tag.de/user_avatar/community.mp3tag.de/vvcepheus7/32/305_2.png) [@vvcepheus7](https://community.mp3tag.de/u/vvcepheus7)
#### Post date: [February 5, 2010, 4:52pm UTC](https://community.mp3tag.de/t/deleting-or-removing-characters-at-the-end-of-a-string/9717/10 "2010-02-05T16:52:21Z")

</div>

> [@dano](#):
>
> Last 4 characters is .{4}$  
> . includes numbers

dano, if I want to create the file name from the title tag but ignoring the last 5 characters of the title of the tag, how could I do it? which is the code to write? in my case, this involves 5 characters generic, not ".mp3".

thank you!

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [February 5, 2010, 5:23pm UTC](https://community.mp3tag.de/t/deleting-or-removing-characters-at-the-end-of-a-string/9717/11 "2010-02-05T17:23:39Z")

</div>

You can use $left(%artist%,$sub($len(%artist%),5))

---

<div class="post-metadata">

### Author: ![vvcepheus7](https://community.mp3tag.de/user_avatar/community.mp3tag.de/vvcepheus7/32/305_2.png) [@vvcepheus7](https://community.mp3tag.de/u/vvcepheus7)
#### Post date: [February 5, 2010, 5:33pm UTC](https://community.mp3tag.de/t/deleting-or-removing-characters-at-the-end-of-a-string/9717/12 "2010-02-05T17:33:58Z")

</div>

thank you dano!

One more question pliz! If I want import cover files (jpg) ignoring the last 5 characters of the name of the jpg file, how could I do it? which is the code to write? is it possible?

thank u!!!

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [February 5, 2010, 7:02pm UTC](https://community.mp3tag.de/t/deleting-or-removing-characters-at-the-end-of-a-string/9717/13 "2010-02-05T19:02:33Z")

</div>

That depends. Is the image name or part of it in the file name or in the tags?

---

<div class="post-metadata">

### Author: ![vvcepheus7](https://community.mp3tag.de/user_avatar/community.mp3tag.de/vvcepheus7/32/305_2.png) [@vvcepheus7](https://community.mp3tag.de/u/vvcepheus7)
#### Post date: [February 5, 2010, 7:39pm UTC](https://community.mp3tag.de/t/deleting-or-removing-characters-at-the-end-of-a-string/9717/14 "2010-02-05T19:39:49Z")

</div>

yes, the name of image is:

name1[XXXX].jpg

the name of the video is:

name1.mp4

the name of the tags of the videos is ever diferent of the name of image file.

now I have to rename the video files to an external program and I would like to do it all with mp3tag if it possible! Only about making mp3Tag ignore the last characters in the video insertion. the photos are screenshots of the videos and the program for capture takes the name of the video and adds day, hour etc.. but the name of the jpg file always has the same length counting from the back of the file name.  
thank u!

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [February 9, 2010, 6:20pm UTC](https://community.mp3tag.de/t/deleting-or-removing-characters-at-the-end-of-a-string/9717/15 "2010-02-09T18:20:40Z")

</div>

I think it is not possible.

---

<div class="post-metadata">

### Author: ![vvcepheus7](https://community.mp3tag.de/user_avatar/community.mp3tag.de/vvcepheus7/32/305_2.png) [@vvcepheus7](https://community.mp3tag.de/u/vvcepheus7)
#### Post date: [February 9, 2010, 7:20pm UTC](https://community.mp3tag.de/t/deleting-or-removing-characters-at-the-end-of-a-string/9717/16 "2010-02-09T19:20:57Z")

</div>

ok, sorrow... 😢

thank u dano

---

<div class="post-metadata">

### Author: ![lnervi](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/46a35a/32.png) [@lnervi](https://community.mp3tag.de/u/lnervi)
#### Post date: [November 2, 2021, 3:18pm UTC](https://community.mp3tag.de/t/deleting-or-removing-characters-at-the-end-of-a-string/9717/17 "2021-11-02T15:18:18Z")

</div>

Hi!  
How are you today?  
Please can you help me?

I Saw Her Standing There - Live At Citi Field, NYC, 2009

I need to remove: " - Live At Citi Field, NYC, 2009"

Many thanks!  
Truly yours!

Lucas

---

<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 2, 2021, 3:23pm UTC](https://community.mp3tag.de/t/deleting-or-removing-characters-at-the-end-of-a-string/9717/18 "2021-11-02T15:23:44Z")

</div>

You could try "Guess value"  
Source: %sourcefield%  
Target: %sourcefield% - %dummy%  
I cannot give you a more detailed description as you do not say in which field you want to delete the string.

---

<div class="post-metadata">

### Author: ![lnervi](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/46a35a/32.png) [@lnervi](https://community.mp3tag.de/u/lnervi)
#### Post date: [November 2, 2021, 3:54pm UTC](https://community.mp3tag.de/t/deleting-or-removing-characters-at-the-end-of-a-string/9717/19 "2021-11-02T15:54:14Z")

</div>

Ups! I'm sorry!  
Is in the Filename or the Title, I think is the same, I can modify them after...  
THANKS for your prompt answer!

Lucas

---

<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 2, 2021, 3:57pm UTC](https://community.mp3tag.de/t/deleting-or-removing-characters-at-the-end-of-a-string/9717/20 "2021-11-02T15:57:11Z")

</div>

> [@lnervi](#):
>
> Filename or the Title, I think is the same

No, these are totally different things.

[Next page](https://community.mp3tag.de/t/deleting-or-removing-characters-at-the-end-of-a-string/9717.md?page=2)
