# Best way to remove a specific character

**URL:** <https://community.mp3tag.de/t/best-way-to-remove-a-specific-character/65098>\
**Category:** Support\
**Created:** [June 20, 2024, 10:14pm UTC](https://community.mp3tag.de/t/best-way-to-remove-a-specific-character/65098 "2024-06-20T22:14:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmach1](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/46a35a/32.png) [@cmach1](https://community.mp3tag.de/u/cmach1)\
**Post date:** [June 20, 2024, 10:14pm UTC](https://community.mp3tag.de/t/best-way-to-remove-a-specific-character/65098/1 "2024-06-20T22:14:10Z")

</div>

This is an example of the folder name that I'm working with:  
Intersound ISCD 112 - Straight Off (1990)

I'm trying to isolate the year without parentheses and copy it to the year field through tag - tag. Using $cutleft(%\_directory%, 36) deletes everything up to 1990, but what do I do to get rid of the ending parenthesis? I thought about using $cutright as well, but that just repeats the directory name and I have to get rid of it all over again from the other side and it became a huge mess.

Can $cutleft and $cutright be used effectively in the same string?

---

<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 21, 2024, 5:46am UTC](https://community.mp3tag.de/t/best-way-to-remove-a-specific-character/65098/2 "2024-06-21T05:46:44Z")

</div>

If you want to get the YEAR from the folder name, you could try Convert\>Filename-Tag with  
Mask: `%dummy%(%year%)\%dummy%`

If you insist on the use of Convert\>Tag-Tag for YEAR then I would use as  
Format string: `$regexp(%_directory%,.*\((\d+)\),$1)`

If you have used

> [@cmach1](#):
>
> $cutleft(%\_directory%, 36)

successfully you could stack that with  
`$replace($cutleft(%_directory%, 36),')',)`  
which replaces the closing bracket with nothing.  
I would still use the regular expression as that takes any length of preceeding text in front of the digits in brackets and not just a fixed 36 characters.

---

<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:** [June 21, 2024, 7:00am UTC](https://community.mp3tag.de/t/best-way-to-remove-a-specific-character/65098/3 "2024-06-21T07:00:53Z")

</div>

> [@cmach1](#):
>
> Can $cutleft and $cutright be used effectively in the same string?

Yes - as @ohrenkino already explained above  
or with something like  
`$cutRight($cutLeft(%_directory%,36),1)`

BUT:  
If you use `$cutleft` and `$cutright` you can handle only **1** specific case at once.  
In your case you get the number at the 37. position (because you would cut away the 36 leading characters and in addition the trailing bracket).  
`Intersound ISCD 112 - Straight Off (1990)`  
`123456789012345678901234567890123456`

This would not work for  
`Intersound ISCD 12 - Straight Off (1990)`  
and not work for  
`Intersound ISCD 112 - Straight Off two (1990)`

If you want to use such a format string to extract the year from different positions, please use one of the mentioned Converters.

---

<div class="post-metadata">

**Author:** ![cmach1](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/46a35a/32.png) [@cmach1](https://community.mp3tag.de/u/cmach1)\
**Post date:** [June 21, 2024, 10:41am UTC](https://community.mp3tag.de/t/best-way-to-remove-a-specific-character/65098/4 "2024-06-21T10:41:49Z")

</div>

That's what I thought. Thanks to you and ohrenkino.

---

<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 21, 2024, 10:42am UTC](https://community.mp3tag.de/t/best-way-to-remove-a-specific-character/65098/5 "2024-07-21T10:42:36Z")

</div>

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