# Filename remove double string

**URL:** <https://community.mp3tag.de/t/filename-remove-double-string/62017>\
**Category:** Support\
**Created:** [September 1, 2023, 5:58pm UTC](https://community.mp3tag.de/t/filename-remove-double-string/62017 "2023-09-01T17:58:52Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![djfrankjoy](https://community.mp3tag.de/user_avatar/community.mp3tag.de/djfrankjoy/32/14735_2.png) [@djfrankjoy](https://community.mp3tag.de/u/djfrankjoy)\
**Post date:** [September 1, 2023, 5:58pm UTC](https://community.mp3tag.de/t/filename-remove-double-string/62017/1 "2023-09-01T17:58:52Z")

</div>

hello  
just a simple action but dont know how.

rename filename from example  
artist\_545155\_545155  
to this  
artist\_545155

many thanks for a fast solution  
Frank

---

<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:** [September 1, 2023, 6:02pm UTC](https://community.mp3tag.de/t/filename-remove-double-string/62017/2 "2023-09-01T18:02:33Z")

</div>

Try Convert\>Filename-Filename  
Mask over file name: %1\_%2\_%3  
Maks for new file name: %1\_%2

---

<div class="post-metadata">

**Author:** ![djfrankjoy](https://community.mp3tag.de/user_avatar/community.mp3tag.de/djfrankjoy/32/14735_2.png) [@djfrankjoy](https://community.mp3tag.de/u/djfrankjoy)\
**Post date:** [September 1, 2023, 6:34pm UTC](https://community.mp3tag.de/t/filename-remove-double-string/62017/3 "2023-09-01T18:34:43Z")

</div>

thanks for fast reply  
in german i tried ersetzen and ersetzen mit but nothing happens, maybe string or mask failures ?  
 ![Screenshot 2023-09-01 203403](https://community.mp3tag.de/uploads/default/original/2X/0/0e0111e1ce583223b92241ff1129fbe29617a429.jpeg)

---

<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:** [September 1, 2023, 6:35pm UTC](https://community.mp3tag.de/t/filename-remove-double-string/62017/4 "2023-09-01T18:35:39Z")

</div>

In German it is Konverter\>Dateiname-Dateiname - no action

---

<div class="post-metadata">

**Author:** ![djfrankjoy](https://community.mp3tag.de/user_avatar/community.mp3tag.de/djfrankjoy/32/14735_2.png) [@djfrankjoy](https://community.mp3tag.de/u/djfrankjoy)\
**Post date:** [September 1, 2023, 6:47pm UTC](https://community.mp3tag.de/t/filename-remove-double-string/62017/5 "2023-09-01T18:47:02Z")

</div>

> [@ohrenkino](#):
>
> %1\_%2\_%3

find the comand but its ot working

---

<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:** [September 1, 2023, 6:50pm UTC](https://community.mp3tag.de/t/filename-remove-double-string/62017/6 "2023-09-01T18:50:14Z")

</div>

as this function has a preview you should see how and where the patterns match.  
If you are not sure, then please provide a screenshot of a real filename as every space character and other characters counts.  
 ![grafik](https://community.mp3tag.de/uploads/default/original/2X/8/82016e36921752322b0b6c81e065b1543e98e43f.png)

---

<div class="post-metadata">

**Author:** ![djfrankjoy](https://community.mp3tag.de/user_avatar/community.mp3tag.de/djfrankjoy/32/14735_2.png) [@djfrankjoy](https://community.mp3tag.de/u/djfrankjoy)\
**Post date:** [September 1, 2023, 7:12pm UTC](https://community.mp3tag.de/t/filename-remove-double-string/62017/8 "2023-09-01T19:12:06Z")

</div>

can this be made as a action comand ?  
my failure was there were more things to consider this works

%1\_%2\_%3\_%4\_%5  
%1\_%2\_%3\_%4

i have many with differett amount ofunderlines  
so i have to separate all to the right amont or is there another way to delete the last number

---

<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:** [September 1, 2023, 7:19pm UTC](https://community.mp3tag.de/t/filename-remove-double-string/62017/9 "2023-09-01T19:19:28Z")

</div>

> [@djfrankjoy](#):
>
> can this be made as a action comand ?

How often will this happen in the life of a file?  
And with a look at the problems that arose initially, wouldn't it be better to control the treated files with a filter?  
e.g.  
`%_filename% MATCHES ".*_\d+_\d+$"`

Then you could create an action of the type "Replace with regular expression" for \_FILENAME  
Search string: `(.*_\d+)_\d+$`  
Replace with: $1

This expression only looks if there are 2 elements consisting of numbers at the end - it does not look whether they are the same.

---

<div class="post-metadata">

**Author:** ![djfrankjoy](https://community.mp3tag.de/user_avatar/community.mp3tag.de/djfrankjoy/32/14735_2.png) [@djfrankjoy](https://community.mp3tag.de/u/djfrankjoy)\
**Post date:** [September 1, 2023, 7:39pm UTC](https://community.mp3tag.de/t/filename-remove-double-string/62017/10 "2023-09-01T19:39:11Z")

</div>

i dont know how often the bug will hold on.  
momentary have 160 tunes with that bug and next time more.  
i will test it the next days and thank you really very very much for your help and i think if its replace the last number it will make my solution.  
i hope i will understand the commands 🙂

---

<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:** [September 1, 2023, 7:51pm UTC](https://community.mp3tag.de/t/filename-remove-double-string/62017/11 "2023-09-01T19:51:23Z")

</div>

> [@djfrankjoy](#):
>
> i dont know how often the bug will hold on.

I would still use the converter as you can control better what happens to the data - an action is executed more or less in the background.  
But you will find the best way for you.

---

<div class="post-metadata">

**Author:** ![djfrankjoy](https://community.mp3tag.de/user_avatar/community.mp3tag.de/djfrankjoy/32/14735_2.png) [@djfrankjoy](https://community.mp3tag.de/u/djfrankjoy)\
**Post date:** [September 1, 2023, 7:55pm UTC](https://community.mp3tag.de/t/filename-remove-double-string/62017/12 "2023-09-01T19:55:20Z")

</div>

![Screenshot 2023-09-01 203403](https://community.mp3tag.de/uploads/default/original/2X/6/69bbe98409b2305179224f309d97e252aeb795c7.jpeg)  
i tried it but doesnt work  
the filter i didnt use because they are like this

---

<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:** [September 1, 2023, 8:03pm UTC](https://community.mp3tag.de/t/filename-remove-double-string/62017/13 "2023-09-01T20:03:01Z")

</div>

And here is the counter example:  
 ![grafik](https://community.mp3tag.de/uploads/default/original/2X/c/c91d0adc0113320266cb2bd35d9b229360946099.png)

But you could try  
Regular expression: ` (.*_\d+)_\d+`

---

<div class="post-metadata">

**Author:** ![djfrankjoy](https://community.mp3tag.de/user_avatar/community.mp3tag.de/djfrankjoy/32/14735_2.png) [@djfrankjoy](https://community.mp3tag.de/u/djfrankjoy)\
**Post date:** [September 2, 2023, 12:43pm UTC](https://community.mp3tag.de/t/filename-remove-double-string/62017/14 "2023-09-02T12:43:22Z")

</div>

the tag tag is not good because i dont want to change the tag, even the tag is okay, just the filename is wrong.  
if you have an idea how to change it all with an action command to delete the last number in the filename it would be awesome.

---

<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:** [September 2, 2023, 1:08pm UTC](https://community.mp3tag.de/t/filename-remove-double-string/62017/15 "2023-09-02T13:08:49Z")

</div>

> [@djfrankjoy](#):
>
> change it all with an action command

Have you tried the last suggestion?

> [@ohrenkino](#):
>
> Regular expression: ` (.*_\d+)_\d+`

which is a little different to  
Regular expression: ` (.*_\d+)_\d+$`

---

<div class="post-metadata">

**Author:** ![djfrankjoy](https://community.mp3tag.de/user_avatar/community.mp3tag.de/djfrankjoy/32/14735_2.png) [@djfrankjoy](https://community.mp3tag.de/u/djfrankjoy)\
**Post date:** [September 2, 2023, 3:32pm UTC](https://community.mp3tag.de/t/filename-remove-double-string/62017/16 "2023-09-02T15:32:05Z")

</div>

> [@ohrenkino](#):
>
> `(.*_\d+)_\d+$`

yes i tried both but nothing happens

![grafik](https://community.mp3tag.de/uploads/default/original/2X/7/7d9b8677aaf07a68716f0652df232cedfa92a272.png)

---

<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:** [September 2, 2023, 3:38pm UTC](https://community.mp3tag.de/t/filename-remove-double-string/62017/17 "2023-09-02T15:38:41Z")

</div>

I still see the `$` at the end of the regular expression - what happens if you delete that?

---

<div class="post-metadata">

**Author:** ![djfrankjoy](https://community.mp3tag.de/user_avatar/community.mp3tag.de/djfrankjoy/32/14735_2.png) [@djfrankjoy](https://community.mp3tag.de/u/djfrankjoy)\
**Post date:** [September 2, 2023, 4:15pm UTC](https://community.mp3tag.de/t/filename-remove-double-string/62017/18 "2023-09-02T16:15:00Z")

</div>

> [@djfrankjoy](#):
>
> yes i tried both but nothing happens

i replied that i tryed both variants  
but nothing happens ☹

---

<div class="post-metadata">

**Author:** ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)\
**Post date:** [September 2, 2023, 4:27pm UTC](https://community.mp3tag.de/t/filename-remove-double-string/62017/19 "2023-09-02T16:27:36Z")

</div>

Are you sure that you try it on the track with the filename  
`artist_545155_545155.mp3`

@ohrenkino's regular expression  
`(.*_\d+)_\d+`  
works fine here:  
 ![RemoveNumbersAfterLastUnderscore](https://community.mp3tag.de/uploads/default/original/2X/c/c1c9b8565d632b67fa39840286fbf34bbb692cb5.gif)  
Could it be that your underscore is not a real underscore, just a character that looks like this?

Please copy your filename from Windows File Explorer in this webpage:  
[https://www.babelstone.co.uk/Unicode/whatisit.html](https://www.babelstone.co.uk/Unicode/whatisit.html)  
There you can see every single character and also if your underscore is a "real" underscore.

A real underscore would appear as "LOW LINE" on the linked analyzing webpage:

 ![image](https://community.mp3tag.de/uploads/default/original/2X/4/4e7dc4a8420b234162b6a38f0e7b33214afbd4d6.png)

---

<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:** [September 2, 2023, 4:39pm UTC](https://community.mp3tag.de/t/filename-remove-double-string/62017/20 "2023-09-02T16:39:18Z")

</div>

> [@djfrankjoy](#):
>
> i replied that i tryed both variants  
> but nothing happens

With the data that you have supplied that result is not plausible.  
And as it seems to be rather tricky to maintain an action that works so clandestine, I would prefer the Converter\>Filename-Filename as that shows immedidately if the expression leads to success or not.

Or an alternative: rewrite the whole filename with Converter\>Tag-Filename and  
Format string: %artist%\_%numberfield%  
(where you have to replace %numberfield% with the real fieldname)

---

<div class="post-metadata">

**Author:** ![djfrankjoy](https://community.mp3tag.de/user_avatar/community.mp3tag.de/djfrankjoy/32/14735_2.png) [@djfrankjoy](https://community.mp3tag.de/u/djfrankjoy)\
**Post date:** [September 3, 2023, 7:36am UTC](https://community.mp3tag.de/t/filename-remove-double-string/62017/21 "2023-09-03T07:36:24Z")

</div>

> [@ohrenkino](#):
>
> numberfield

Hello  
a big big hug to ohrenkino and LyricsLover 👍 👍  
as we expected the failure was on my side 😢  
through several times watching the vid, but couldn't pause to see  
i discovered a little difference in the command with a space at start 😭  
it works perfect now 😃 😃

one question to the add with numberfield.  
i was thinking about that, but i dont know if its hidden in the tags or only in the filename,  
how can i check that ? its called id number from the platorm side

[Next page](https://community.mp3tag.de/t/filename-remove-double-string/62017.md?page=2)
