# How to Cutright from a char str: can't get it work

**URL:** <https://community.mp3tag.de/t/how-to-cutright-from-a-char-str-cant-get-it-work/61389>\
**Category:** Support\
**Created:** [June 26, 2023, 1:24pm UTC](https://community.mp3tag.de/t/how-to-cutright-from-a-char-str-cant-get-it-work/61389 "2023-06-26T13:24:09Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![dec](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dec/32/13699_2.png) [@dec](https://community.mp3tag.de/u/dec)\
**Post date:** [June 26, 2023, 1:24pm UTC](https://community.mp3tag.de/t/how-to-cutright-from-a-char-str-cant-get-it-work/61389/1 "2023-06-26T13:24:10Z")

</div>

Picard just automatically just trashed all my File Names and added rubbish at the end of each file name without so much as a say-so. it did other damage as well, but i am/have fixed most of that.

i have worked out that the last valid string at the end of every file name is "(NORM)"

see attached example

so i want to truncate the file name from that to the rhs end of file name

but do you think i can work out a way that actually works!

i played with $left and $cut right and $strstr, but i couldn't get anything to actually work

can someone show me a regex string that works? 🙂

 ![mp3tag-26-06-2023 19-42-33](https://community.mp3tag.de/uploads/default/original/2X/a/a2f9c230e98a79b5d52618047a459aa6c918ed64.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:** [June 26, 2023, 1:28pm UTC](https://community.mp3tag.de/t/how-to-cutright-from-a-char-str-cant-get-it-work/61389/2 "2023-06-26T13:28:34Z")

</div>

Try Convert\>Filename-Filename  
Old filename pattern: %1 (NORM) %2  
New filename pattern: %1 (NORM)

---

<div class="post-metadata">

**Author:** ![dec](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dec/32/13699_2.png) [@dec](https://community.mp3tag.de/u/dec)\
**Post date:** [June 26, 2023, 2:51pm UTC](https://community.mp3tag.de/t/how-to-cutright-from-a-char-str-cant-get-it-work/61389/3 "2023-06-26T14:51:00Z")

</div>

ok. ty,

i get that, although i have not used before

let me give that try

---

<div class="post-metadata">

**Author:** ![dec](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dec/32/13699_2.png) [@dec](https://community.mp3tag.de/u/dec)\
**Post date:** [June 26, 2023, 10:21pm UTC](https://community.mp3tag.de/t/how-to-cutright-from-a-char-str-cant-get-it-work/61389/4 "2023-06-26T22:21:44Z")

</div>

but, why didn't using cutright and strstr work?  
ie something like this which is about the same as what i was trying ...

$cutright(%title%,$strstr(%title%,norm))

---

<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:** [June 27, 2023, 5:06am UTC](https://community.mp3tag.de/t/how-to-cutright-from-a-char-str-cant-get-it-work/61389/5 "2023-06-27T05:06:47Z")

</div>

Has the converter worked?

> [@dec](#):
>
> but, why didn't using cutright and strstr work?

You don't explain what did not work.  
Have you checked which position `

> [@dec](#):
>
> $strstr(%title%,norm))

returns and how many characters from the right that would be?

I tried to explain the basic behaviour of $cutright() in this post for you:

> [@Odd STRCHR Error](https://community.mp3tag.de/t/odd-strchr-error/61310/7):
>
> $cutright does not "cut from the right" but - as the documentation tells you: $cutRight(x,n) removes the last n characters of string x and returns the result. The accidental result with Billie Holiday only works because the part in front of the hyphen is just as long as the part behind it. Bill Withers has the hyphen at position 14 and if you remove the 14 characters on the right with $cutright() you end up with the string shown in the preview. If you want to cut the filename so that only th…

You would have to calculate either how many characters you want to keep and use $left() or how many characters you would have to include if you want to cut off a part of a string from the right.  
And if you want to find a variable position in a string and use $cutright() (instead of $left()) then you have to subtract that position from the total length of the string.

---

<div class="post-metadata">

**Author:** ![dec](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dec/32/13699_2.png) [@dec](https://community.mp3tag.de/u/dec)\
**Post date:** [June 28, 2023, 12:45pm UTC](https://community.mp3tag.de/t/how-to-cutright-from-a-char-str-cant-get-it-work/61389/6 "2023-06-28T12:45:16Z")

</div>

i can see i did not explain fully the detals of what i could see myself

this length text string is embedded in say Title and/or Filename

so .... (1324) ... say

the problem always seems that the leading chars are always a variable length (because they include the artist & track names)

and the text after artist/title are not consistent or the same length either

this is starting to look like Mission Impossible 🙂

all we know that there IS a string '(\*\*\*\*min)' in the name

---

<div class="post-metadata">

**Author:** ![dec](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dec/32/13699_2.png) [@dec](https://community.mp3tag.de/u/dec)\
**Post date:** [June 28, 2023, 12:48pm UTC](https://community.mp3tag.de/t/how-to-cutright-from-a-char-str-cant-get-it-work/61389/7 "2023-06-28T12:48:23Z")

</div>

i see this is better covered in other Topic?

---

<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:** [June 28, 2023, 12:56pm UTC](https://community.mp3tag.de/t/how-to-cutright-from-a-char-str-cant-get-it-work/61389/8 "2023-06-28T12:56:18Z")

</div>

> [@ohrenkino](#):
>
> Has the converter worked?

The converter can look for a constant string at a variable position.

And otherwise in general: the more of the original data is visible, the closer the suggestions will be to a solution - because I do not feel included in

> [@dec](#):
>
> all we know that there IS a string '(\*\*\*\*min)' in the name

as I don't know what data you are talking about.

---

<div class="post-metadata">

**Author:** ![dec](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dec/32/13699_2.png) [@dec](https://community.mp3tag.de/u/dec)\
**Post date:** [June 28, 2023, 12:58pm UTC](https://community.mp3tag.de/t/how-to-cutright-from-a-char-str-cant-get-it-work/61389/9 "2023-06-28T12:58:41Z")

</div>

i post in other Topic

---

<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:** [June 28, 2023, 12:59pm UTC](https://community.mp3tag.de/t/how-to-cutright-from-a-char-str-cant-get-it-work/61389/10 "2023-06-28T12:59:11Z")

</div>

What about an answer to the questions and suggestions?

---

<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:** [July 28, 2023, 12:59pm UTC](https://community.mp3tag.de/t/how-to-cutright-from-a-char-str-cant-get-it-work/61389/11 "2023-07-28T12:59:32Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
