# how to delete the last word from the string

**URL:** https://community.mp3tag.de/t/how-to-delete-the-last-word-from-the-string/11367
**Category:** General Discussion
**Created:** [December 30, 2010, 10:10pm UTC](https://community.mp3tag.de/t/how-to-delete-the-last-word-from-the-string/11367 "2010-12-30T22:10:42Z")
**Posts on this page:** 3
**Page:** 1

<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: [December 30, 2010, 10:10pm UTC](https://community.mp3tag.de/t/how-to-delete-the-last-word-from-the-string/11367/1 "2010-12-30T22:10:42Z")

</div>

i have a title like this--

Mayamma-ahiri-extraordinary

please note that there is no space between words and the dash.

i want to delete the last word from the string.  
want to get title as

Mayamma-ahiri

i tried the following  
filename to filename (after getting it in the filename of course)  
old pattern---$1-$2-$3  
new pattern--$1-$2  
but it does not work.

i tried guess values in title  
it did not work

i tried filename to tag  
%title%-%title%-%dummy%  
gives me

Mayamma ahiri

how i miss the dash between words?

---

<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: [December 30, 2010, 10:15pm UTC](https://community.mp3tag.de/t/how-to-delete-the-last-word-from-the-string/11367/2 "2010-12-30T22:15:16Z")

</div>

The correct syntax for filename - filename is  
old pattern %1-%2-%3  
new pattern %1-%2

---

<div class="post-metadata">

### Author: ![pone](https://community.mp3tag.de/user_avatar/community.mp3tag.de/pone/32/272_2.png) [@pone](https://community.mp3tag.de/u/pone)
#### Post date: [December 30, 2010, 11:17pm UTC](https://community.mp3tag.de/t/how-to-delete-the-last-word-from-the-string/11367/3 "2010-12-30T23:17:38Z")

</div>

Action: Format Value  
Field: TITLE  
Formatstring: $regexp(%title%,(._)-(._),$1)

or

Action: Replace with regular expression:  
Field: TITLE  
Regular Expression: (._)-(._)  
Replace Matches With: $1
